From 48c890be61b26b4bf0b3767df994e036a14dda66 Mon Sep 17 00:00:00 2001 From: cj-dev Date: Wed, 9 Aug 2017 16:19:43 -0400 Subject: [PATCH] #4434 Test Config Base Class (#4974) * Addressing #4434 by implementing ConfigTestCase which mocks out a NamespaceConfig for consistent config use across tests * Refactor account_test.py for use with ConfigTestCase * Remove superfluous setup/teardown * Pylint oops. * Fix redundant inheritance class definitions * Separate ConfigTestCase's mocked directories * Module import style consistency * Refactor log_test.py for use with ConfigTestCase * Refactor eff_test.py for use with ConfigTestCase. Also tweak for import style consistency * Refactor reverter_test.py for use with ConfigTestCase * Refactor renewal_test.py for use with ConfigTestCase * Refactor main_test.py for use with ConfigTestCase * Refactor storage_test.py for use with ConfigTestCase * Refactor cert_manager_test.py for use with ConfigTestCase * Refactor client_test.py for use with ConfigTestCase * Refactor configuration_test.py for use with ConfigTestCase * Pylint! * Incorporating PR feedback * Remove comment --- certbot/tests/account_test.py | 15 +- certbot/tests/cert_manager_test.py | 158 ++++++++++----------- certbot/tests/client_test.py | 30 ++-- certbot/tests/configuration_test.py | 50 ++++--- certbot/tests/eff_test.py | 24 ++-- certbot/tests/log_test.py | 15 +- certbot/tests/main_test.py | 60 +++----- certbot/tests/renewal_test.py | 23 ++- certbot/tests/reverter_test.py | 23 +-- certbot/tests/storage_test.py | 211 +++++++++++++--------------- certbot/tests/util.py | 15 ++ 11 files changed, 284 insertions(+), 340 deletions(-) diff --git a/certbot/tests/account_test.py b/certbot/tests/account_test.py index 5950dcda9..575a40286 100644 --- a/certbot/tests/account_test.py +++ b/certbot/tests/account_test.py @@ -14,12 +14,10 @@ from acme import messages from certbot import errors -from certbot.tests import util - -from certbot.tests.util import TempDirTestCase +import certbot.tests.util as test_util -KEY = jose.JWKRSA.load(util.load_vector("rsa512_key_2.pem")) +KEY = jose.JWKRSA.load(test_util.load_vector("rsa512_key_2.pem")) class AccountTest(unittest.TestCase): @@ -58,12 +56,9 @@ class AccountTest(unittest.TestCase): self.assertTrue(repr(self.acc).startswith( "