NSX|V3 make certificate unittests inherit from sql tests

The client certificate unittests should inherit from SqlTestCase.
This may solve some errors we encountered in those tests recently.

Change-Id: If1f3c5bae58c5adc9fc8a78f6b2fded1bfd9294e
This commit is contained in:
Adit Sarfaty 2017-09-27 09:26:43 +03:00
parent 25a19ec04b
commit 22442f1728

View File

@ -14,17 +14,18 @@
# limitations under the License. # limitations under the License.
import os import os
import unittest
import mock import mock
from oslo_config import cfg from oslo_config import cfg
from neutron.tests.unit import testlib_api
from vmware_nsx.common import exceptions as nsx_exc from vmware_nsx.common import exceptions as nsx_exc
from vmware_nsx.plugins.nsx_v3 import cert_utils from vmware_nsx.plugins.nsx_v3 import cert_utils
from vmware_nsx.plugins.nsx_v3 import utils from vmware_nsx.plugins.nsx_v3 import utils
class NsxV3ClientCertProviderTestCase(unittest.TestCase): class NsxV3ClientCertProviderTestCase(testlib_api.SqlTestCase):
CERT = "-----BEGIN CERTIFICATE-----\n" \ CERT = "-----BEGIN CERTIFICATE-----\n" \
"MIIDJTCCAg0CBFh36j0wDQYJKoZIhvcNAQELBQAwVzELMAkGA1UEBhMCVVMxEzAR\n" \ "MIIDJTCCAg0CBFh36j0wDQYJKoZIhvcNAQELBQAwVzELMAkGA1UEBhMCVVMxEzAR\n" \
@ -153,7 +154,7 @@ class NsxV3ClientCertProviderTestCase(unittest.TestCase):
secret = cert_utils.generate_secret_from_password(password) secret = cert_utils.generate_secret_from_password(password)
encrypted_pkey = cert_utils.symmetric_encrypt(secret, self.PKEY) encrypted_pkey = cert_utils.symmetric_encrypt(secret, self.PKEY)
# db should countain encrypted key # db should contain encrypted key
mock.patch( mock.patch(
"vmware_nsx.db.db.get_certificate", "vmware_nsx.db.db.get_certificate",
return_value=(self.CERT, encrypted_pkey)).start() return_value=(self.CERT, encrypted_pkey)).start()