From d4336b3ca138f7a59605c739fca20b7790cb3bf0 Mon Sep 17 00:00:00 2001 From: James Kasten Date: Mon, 30 Mar 2015 16:01:26 -0700 Subject: [PATCH] finish renaming/shorten name --- docs/api/client/client_authenticator.rst | 5 ----- docs/api/client/continuity_auth.rst | 5 +++++ letsencrypt/client/client.py | 9 ++++---- ...ty_authenticator.py => continuity_auth.py} | 4 ++-- letsencrypt/client/errors.py | 2 +- letsencrypt/client/tests/auth_handler_test.py | 22 +++++++++---------- ...icator_test.py => continuity_auth_test.py} | 8 +++---- 7 files changed, 28 insertions(+), 27 deletions(-) delete mode 100644 docs/api/client/client_authenticator.rst create mode 100644 docs/api/client/continuity_auth.rst rename letsencrypt/client/{continuity_authenticator.py => continuity_auth.py} (91%) rename letsencrypt/client/tests/{continuity_authenticator_test.py => continuity_auth_test.py} (88%) diff --git a/docs/api/client/client_authenticator.rst b/docs/api/client/client_authenticator.rst deleted file mode 100644 index 267a0dd50..000000000 --- a/docs/api/client/client_authenticator.rst +++ /dev/null @@ -1,5 +0,0 @@ -:mod:`letsencrypt.client.client_authenticator` ----------------------------------------------- - -.. automodule:: letsencrypt.client.client_authenticator - :members: diff --git a/docs/api/client/continuity_auth.rst b/docs/api/client/continuity_auth.rst new file mode 100644 index 000000000..d143a7a79 --- /dev/null +++ b/docs/api/client/continuity_auth.rst @@ -0,0 +1,5 @@ +:mod:`letsencrypt.client.continuity_auth` +---------------------------------------------- + +.. automodule:: letsencrypt.client.continuity_auth + :members: diff --git a/letsencrypt/client/client.py b/letsencrypt/client/client.py index 25a1cc1f6..61b9a8de3 100644 --- a/letsencrypt/client/client.py +++ b/letsencrypt/client/client.py @@ -10,7 +10,7 @@ from letsencrypt.acme import messages from letsencrypt.acme import util as acme_util from letsencrypt.client import auth_handler -from letsencrypt.client import continuity_authenticator +from letsencrypt.client import continuity_auth from letsencrypt.client import crypto_util from letsencrypt.client import errors from letsencrypt.client import le_util @@ -33,7 +33,8 @@ class Client(object): :type authkey: :class:`letsencrypt.client.le_util.Key` :ivar auth_handler: Object that supports the IAuthenticator interface. - auth_handler contains both a dv_authenticator and a continuity_authenticator + auth_handler contains both a dv_authenticator and a + continuity_authenticator :type auth_handler: :class:`letsencrypt.client.auth_handler.AuthHandler` :ivar installer: Object supporting the IInstaller interface. @@ -60,9 +61,9 @@ class Client(object): self.config = config if dv_auth is not None: - client_auth = continuity_authenticator.ContinuityAuthenticator(config) + cont_auth = continuity_auth.ContinuityAuthenticator(config) self.auth_handler = auth_handler.AuthHandler( - dv_auth, client_auth, self.network) + dv_auth, cont_auth, self.network) else: self.auth_handler = None diff --git a/letsencrypt/client/continuity_authenticator.py b/letsencrypt/client/continuity_auth.py similarity index 91% rename from letsencrypt/client/continuity_authenticator.py rename to letsencrypt/client/continuity_auth.py index af979a7c2..4db5a177e 100644 --- a/letsencrypt/client/continuity_authenticator.py +++ b/letsencrypt/client/continuity_auth.py @@ -41,7 +41,7 @@ class ContinuityAuthenticator(object): if isinstance(achall, achallenges.RecoveryToken): responses.append(self.rec_token.perform(achall)) else: - raise errors.LetsEncryptClientAuthError("Unexpected Challenge") + raise errors.LetsEncryptContAuthError("Unexpected Challenge") return responses def cleanup(self, achalls): @@ -50,4 +50,4 @@ class ContinuityAuthenticator(object): if isinstance(achall, achallenges.RecoveryToken): self.rec_token.cleanup(achall) else: - raise errors.LetsEncryptClientAuthError("Unexpected Challenge") + raise errors.LetsEncryptContAuthError("Unexpected Challenge") diff --git a/letsencrypt/client/errors.py b/letsencrypt/client/errors.py index c1d6c785f..23bfc8000 100644 --- a/letsencrypt/client/errors.py +++ b/letsencrypt/client/errors.py @@ -14,7 +14,7 @@ class LetsEncryptAuthHandlerError(LetsEncryptClientError): """Let's Encrypt Auth Handler error.""" -class LetsEncryptClientAuthError(LetsEncryptAuthHandlerError): +class LetsEncryptContAuthError(LetsEncryptAuthHandlerError): """Let's Encrypt Client Authenticator error.""" diff --git a/letsencrypt/client/tests/auth_handler_test.py b/letsencrypt/client/tests/auth_handler_test.py index 3349ebdf9..b26b61b3d 100644 --- a/letsencrypt/client/tests/auth_handler_test.py +++ b/letsencrypt/client/tests/auth_handler_test.py @@ -30,17 +30,17 @@ class SatisfyChallengesTest(unittest.TestCase): from letsencrypt.client.auth_handler import AuthHandler self.mock_dv_auth = mock.MagicMock(name="ApacheConfigurator") - self.mock_client_auth = mock.MagicMock(name="ContinuityAuthenticator") + self.mock_cont_auth = mock.MagicMock(name="ContinuityAuthenticator") self.mock_dv_auth.get_chall_pref.return_value = [challenges.DVSNI] - self.mock_client_auth.get_chall_pref.return_value = [ + self.mock_cont_auth.get_chall_pref.return_value = [ challenges.RecoveryToken] - self.mock_client_auth.perform.side_effect = gen_auth_resp + self.mock_cont_auth.perform.side_effect = gen_auth_resp self.mock_dv_auth.perform.side_effect = gen_auth_resp self.handler = AuthHandler( - self.mock_dv_auth, self.mock_client_auth, None) + self.mock_dv_auth, self.mock_cont_auth, None) logging.disable(logging.CRITICAL) @@ -78,7 +78,7 @@ class SatisfyChallengesTest(unittest.TestCase): self.assertEqual(len(self.handler.responses[dom]), 1) # Test if statement for dv_auth perform - self.assertEqual(self.mock_client_auth.perform.call_count, 1) + self.assertEqual(self.mock_cont_auth.perform.call_count, 1) self.assertEqual(self.mock_dv_auth.perform.call_count, 0) self.assertEqual("RecoveryToken0", self.handler.responses[dom][0]) @@ -106,7 +106,7 @@ class SatisfyChallengesTest(unittest.TestCase): # Each message contains 1 auth, 0 client # Test proper call count for methods - self.assertEqual(self.mock_client_auth.perform.call_count, 0) + self.assertEqual(self.mock_cont_auth.perform.call_count, 0) self.assertEqual(self.mock_dv_auth.perform.call_count, 1) for i in xrange(5): @@ -141,7 +141,7 @@ class SatisfyChallengesTest(unittest.TestCase): self.assertEqual(len(self.handler.client_c), 1) # Test if statement for client_auth perform - self.assertEqual(self.mock_client_auth.perform.call_count, 0) + self.assertEqual(self.mock_cont_auth.perform.call_count, 0) self.assertEqual(self.mock_dv_auth.perform.call_count, 1) self.assertEqual( @@ -309,11 +309,11 @@ class SatisfyChallengesTest(unittest.TestCase): # Verify cleanup is actually run correctly self.assertEqual(self.mock_dv_auth.cleanup.call_count, 2) - self.assertEqual(self.mock_client_auth.cleanup.call_count, 2) + self.assertEqual(self.mock_cont_auth.cleanup.call_count, 2) dv_cleanup_args = self.mock_dv_auth.cleanup.call_args_list - client_cleanup_args = self.mock_client_auth.cleanup.call_args_list + client_cleanup_args = self.mock_cont_auth.cleanup.call_args_list # Check DV cleanup for i in xrange(2): @@ -346,7 +346,7 @@ class GetAuthorizationsTest(unittest.TestCase): from letsencrypt.client.auth_handler import AuthHandler self.mock_dv_auth = mock.MagicMock(name="ApacheConfigurator") - self.mock_client_auth = mock.MagicMock(name="ContinuityAuthenticator") + self.mock_cont_auth = mock.MagicMock(name="ContinuityAuthenticator") self.mock_sat_chall = mock.MagicMock(name="_satisfy_challenges") self.mock_acme_auth = mock.MagicMock(name="acme_authorization") @@ -354,7 +354,7 @@ class GetAuthorizationsTest(unittest.TestCase): self.iteration = 0 self.handler = AuthHandler( - self.mock_dv_auth, self.mock_client_auth, None) + self.mock_dv_auth, self.mock_cont_auth, None) self.handler._satisfy_challenges = self.mock_sat_chall self.handler.acme_authorization = self.mock_acme_auth diff --git a/letsencrypt/client/tests/continuity_authenticator_test.py b/letsencrypt/client/tests/continuity_auth_test.py similarity index 88% rename from letsencrypt/client/tests/continuity_authenticator_test.py rename to letsencrypt/client/tests/continuity_auth_test.py index 1f1d8f3f8..c1f4a229c 100644 --- a/letsencrypt/client/tests/continuity_authenticator_test.py +++ b/letsencrypt/client/tests/continuity_auth_test.py @@ -13,7 +13,7 @@ class PerformTest(unittest.TestCase): """Test client perform function.""" def setUp(self): - from letsencrypt.client.continuity_authenticator import ContinuityAuthenticator + from letsencrypt.client.continuity_auth import ContinuityAuthenticator self.auth = ContinuityAuthenticator( mock.MagicMock(server="demo_server.org")) @@ -38,7 +38,7 @@ class PerformTest(unittest.TestCase): def test_unexpected(self): self.assertRaises( - errors.LetsEncryptClientAuthError, self.auth.perform, [ + errors.LetsEncryptContAuthError, self.auth.perform, [ achallenges.DVSNI(chall=None, domain="0", key="invalid_key")]) def test_chall_pref(self): @@ -50,7 +50,7 @@ class CleanupTest(unittest.TestCase): """Test the Authenticator cleanup function.""" def setUp(self): - from letsencrypt.client.continuity_authenticator import ContinuityAuthenticator + from letsencrypt.client.continuity_auth import ContinuityAuthenticator self.auth = ContinuityAuthenticator( mock.MagicMock(server="demo_server.org")) @@ -70,7 +70,7 @@ class CleanupTest(unittest.TestCase): token = achallenges.RecoveryToken(chall=None, domain="0") unexpected = achallenges.DVSNI(chall=None, domain="0", key="dummy_key") - self.assertRaises(errors.LetsEncryptClientAuthError, + self.assertRaises(errors.LetsEncryptContAuthError, self.auth.cleanup, [token, unexpected])