From 3718cf63ae27e707e5ecf667382afcf8313609d2 Mon Sep 17 00:00:00 2001 From: Diana Clarke Date: Wed, 3 Feb 2016 23:27:45 -0500 Subject: [PATCH] Database not needed for most crypto tests The following test classes don't access the database, so make them extend NoDBTestCase. - EncryptionTests - CertExceptionTests - KeyPairTest - RevokeCertsTest $ tox -e py27 nova.tests.unit.test_crypto Runtime before: 41.2091 sec Runtime after: 19.7760 sec Change-Id: I0fd7a573c36d0fe2e96bf1dc045622cc39187f02 --- nova/tests/unit/test_crypto.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nova/tests/unit/test_crypto.py b/nova/tests/unit/test_crypto.py index 214f3c8ed4..1a96dfa890 100644 --- a/nova/tests/unit/test_crypto.py +++ b/nova/tests/unit/test_crypto.py @@ -91,7 +91,7 @@ class X509Test(test.TestCase): self.assertEqual(start, os.getcwd()) -class RevokeCertsTest(test.TestCase): +class RevokeCertsTest(test.NoDBTestCase): @mock.patch('nova.crypto.revoke_cert') def test_revoke_certs_by_user_and_project(self, mock_revoke): @@ -160,7 +160,7 @@ class RevokeCertsTest(test.TestCase): str(uuid.uuid4()), 'test_file') -class CertExceptionTests(test.TestCase): +class CertExceptionTests(test.NoDBTestCase): def test_fetch_ca_file_not_found(self): with utils.tempdir() as tmpdir: self.flags(ca_path=tmpdir) @@ -178,7 +178,7 @@ class CertExceptionTests(test.TestCase): crypto.fetch_crl, project_id='fake') -class EncryptionTests(test.TestCase): +class EncryptionTests(test.NoDBTestCase): pubkey = ("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDArtgrfBu/g2o28o+H2ng/crv" "zgES91i/NNPPFTOutXelrJ9QiPTPTm+B8yspLsXifmbsmXztNOlBQgQXs6usxb4" "fnJKNUZ84Vkp5esbqK/L7eyRqwPvqo7btKBMoAMVX/kUyojMpxb7Ssh6M6Y8cpi" @@ -255,7 +255,7 @@ e6fCXWECgYEAqgpGvva5kJ1ISgNwnJbwiNw0sOT9BMOsdNZBElf0kJIIy6FMPvap crypto.ssh_encrypt_text, '', self.text) -class KeyPairTest(test.TestCase): +class KeyPairTest(test.NoDBTestCase): rsa_prv = ( "-----BEGIN RSA PRIVATE KEY-----\n" "MIIEowIBAAKCAQEA5G44D6lEgMj6cRwCPydsMl1VRN2B9DVyV5lmwssGeJClywZM\n"