mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 00:35:03 +02:00
give register full test coverage
This commit is contained in:
@@ -954,7 +954,11 @@ class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods
|
||||
"--register-unsafely-without-email".split())
|
||||
self.assertTrue("--register-unsafely-without-email" in x[0])
|
||||
|
||||
def test_update_registration_with_email(self):
|
||||
@mock.patch('certbot.main.display_ops.get_email')
|
||||
@mock.patch('certbot.main.zope.component.getUtility')
|
||||
def test_update_registration_with_email(self, mock_utility, mock_email):
|
||||
email = "user@example.com"
|
||||
mock_email.return_value = email
|
||||
with mock.patch('certbot.main.client') as mocked_client:
|
||||
with mock.patch('certbot.main.account') as mocked_account:
|
||||
with mock.patch('certbot.main._determine_account') as mocked_det:
|
||||
@@ -966,8 +970,7 @@ class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods
|
||||
acme_client = mock.MagicMock()
|
||||
mocked_client.Client.return_value = acme_client
|
||||
x = self._call_no_clientmock(
|
||||
["register", "--update-registration", "--email",
|
||||
"user@example.org"])
|
||||
["register", "--update-registration"])
|
||||
# When registration change succeeds, the return value
|
||||
# of register() is None
|
||||
self.assertTrue(x[0] is None)
|
||||
@@ -977,6 +980,8 @@ class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods
|
||||
acme_client.acme.update_registration.called)
|
||||
# and we saved the updated registration on disk
|
||||
self.assertTrue(mocked_storage.save_regr.called)
|
||||
self.assertTrue(
|
||||
email in mock_utility().add_message.call_args[0][0])
|
||||
|
||||
def test_conflicting_args(self):
|
||||
args = ['renew', '--dialog', '--text']
|
||||
|
||||
Reference in New Issue
Block a user