mirror of
https://github.com/certbot/certbot.git
synced 2026-06-03 22:08:07 -04:00
Call certbot client cb_client rather than acme_client (#4357)
In some sense, certbot.client.Client is an ACME client, but it's the not the client in the ACME library and this leads to confusion. Let's make what this is clear. * call certbot client cb_client rather than acme_client * update tests
This commit is contained in:
parent
da1cfa85fc
commit
2e8a5ef477
2 changed files with 14 additions and 14 deletions
|
|
@ -407,10 +407,10 @@ def unregister(config, unused_plugins):
|
|||
return "Deactivation aborted."
|
||||
|
||||
acc, acme = _determine_account(config)
|
||||
acme_client = client.Client(config, acc, None, None, acme=acme)
|
||||
cb_client = client.Client(config, acc, None, None, acme=acme)
|
||||
|
||||
# delete on boulder
|
||||
acme_client.acme.deactivate_registration(acc.regr)
|
||||
cb_client.acme.deactivate_registration(acc.regr)
|
||||
account_files = account.AccountFileStorage(config)
|
||||
# delete local account files
|
||||
account_files.delete(config.account)
|
||||
|
|
@ -452,11 +452,11 @@ def register(config, unused_plugins):
|
|||
config.email = display_ops.get_email(optional=False)
|
||||
|
||||
acc, acme = _determine_account(config)
|
||||
acme_client = client.Client(config, acc, None, None, acme=acme)
|
||||
cb_client = client.Client(config, acc, None, None, acme=acme)
|
||||
# We rely on an exception to interrupt this process if it didn't work.
|
||||
acc.regr = acme_client.acme.update_registration(acc.regr.update(
|
||||
acc.regr = cb_client.acme.update_registration(acc.regr.update(
|
||||
body=acc.regr.body.update(contact=('mailto:' + config.email,))))
|
||||
account_storage.save_regr(acc, acme_client.acme)
|
||||
account_storage.save_regr(acc, cb_client.acme)
|
||||
eff.handle_subscription(config)
|
||||
add_msg("Your e-mail address was updated to {0}.".format(config.email))
|
||||
|
||||
|
|
|
|||
|
|
@ -1093,8 +1093,8 @@ class MainTest(test_util.TempDirTestCase): # pylint: disable=too-many-public-me
|
|||
mocked_account.AccountFileStorage.return_value = mocked_storage
|
||||
mocked_storage.find_all.return_value = ["an account"]
|
||||
mocked_det.return_value = (mock.MagicMock(), "foo")
|
||||
acme_client = mock.MagicMock()
|
||||
mocked_client.Client.return_value = acme_client
|
||||
cb_client = mock.MagicMock()
|
||||
mocked_client.Client.return_value = cb_client
|
||||
x = self._call_no_clientmock(
|
||||
["register", "--update-registration"])
|
||||
# When registration change succeeds, the return value
|
||||
|
|
@ -1103,7 +1103,7 @@ class MainTest(test_util.TempDirTestCase): # pylint: disable=too-many-public-me
|
|||
# and we got supposedly did update the registration from
|
||||
# the server
|
||||
self.assertTrue(
|
||||
acme_client.acme.update_registration.called)
|
||||
cb_client.acme.update_registration.called)
|
||||
# and we saved the updated registration on disk
|
||||
self.assertTrue(mocked_storage.save_regr.called)
|
||||
self.assertTrue(
|
||||
|
|
@ -1143,8 +1143,8 @@ class UnregisterTest(unittest.TestCase):
|
|||
self.mocks['account'].AccountFileStorage.return_value = mocked_storage
|
||||
self.mocks['_determine_account'].return_value = (mock.MagicMock(), "foo")
|
||||
|
||||
acme_client = mock.MagicMock()
|
||||
self.mocks['client'].Client.return_value = acme_client
|
||||
cb_client = mock.MagicMock()
|
||||
self.mocks['client'].Client.return_value = cb_client
|
||||
|
||||
config = mock.MagicMock()
|
||||
unused_plugins = mock.MagicMock()
|
||||
|
|
@ -1152,7 +1152,7 @@ class UnregisterTest(unittest.TestCase):
|
|||
res = main.unregister(config, unused_plugins)
|
||||
|
||||
self.assertTrue(res is None)
|
||||
self.assertTrue(acme_client.acme.deactivate_registration.called)
|
||||
self.assertTrue(cb_client.acme.deactivate_registration.called)
|
||||
m = "Account deactivated."
|
||||
self.assertTrue(m in self.mocks['get_utility']().add_message.call_args[0][0])
|
||||
|
||||
|
|
@ -1161,8 +1161,8 @@ class UnregisterTest(unittest.TestCase):
|
|||
mocked_storage.find_all.return_value = []
|
||||
self.mocks['account'].AccountFileStorage.return_value = mocked_storage
|
||||
|
||||
acme_client = mock.MagicMock()
|
||||
self.mocks['client'].Client.return_value = acme_client
|
||||
cb_client = mock.MagicMock()
|
||||
self.mocks['client'].Client.return_value = cb_client
|
||||
|
||||
config = mock.MagicMock()
|
||||
unused_plugins = mock.MagicMock()
|
||||
|
|
@ -1170,7 +1170,7 @@ class UnregisterTest(unittest.TestCase):
|
|||
res = main.unregister(config, unused_plugins)
|
||||
m = "Could not find existing account to deactivate."
|
||||
self.assertEqual(res, m)
|
||||
self.assertFalse(acme_client.acme.deactivate_registration.called)
|
||||
self.assertFalse(cb_client.acme.deactivate_registration.called)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Reference in a new issue