mirror of
https://github.com/certbot/certbot.git
synced 2026-07-27 08:09:10 +02:00
incorp peter's feedback
This commit is contained in:
+4
-4
@@ -151,10 +151,10 @@ def perform_registration(acme, config):
|
||||
except messages.Error as e:
|
||||
if e.typ == "urn:acme:error:invalidEmail":
|
||||
if config.noninteractive_mode:
|
||||
msg = ("The email you specified was unable to be verified "
|
||||
"by acme. Please ensure it is a valid email and "
|
||||
"attempt registration again.")
|
||||
raise errors.MissingCommandlineFlag(msg)
|
||||
msg = ("The ACME server believes %s is an invalid email address. "
|
||||
"Please ensure it is a valid email and attempt "
|
||||
"registration again." % config.email)
|
||||
raise errors.Error(msg)
|
||||
else:
|
||||
config.namespace.email = display_ops.get_email(invalid=True)
|
||||
return perform_registration(acme, config)
|
||||
|
||||
@@ -61,13 +61,13 @@ class RegisterTest(unittest.TestCase):
|
||||
|
||||
@mock.patch("certbot.account.report_new_account")
|
||||
@mock.patch("certbot.client.display_ops.get_email")
|
||||
def test_email_retry(self, _rep, mock_get_email):
|
||||
def test_email_invalid_noninteractive(self, _rep, mock_get_email):
|
||||
from acme import messages
|
||||
msg = "DNS problem: NXDOMAIN looking up MX for example.com"
|
||||
mx_err = messages.Error(detail=msg, typ="urn:acme:error:invalidEmail")
|
||||
with mock.patch("certbot.client.acme_client.Client") as mock_client:
|
||||
mock_client().register.side_effect = [mx_err, mock.MagicMock()]
|
||||
self.assertRaises(errors.MissingCommandlineFlag, self._call)
|
||||
self.assertRaises(errors.Error, self._call)
|
||||
|
||||
def test_needs_email(self):
|
||||
self.config.email = None
|
||||
|
||||
Reference in New Issue
Block a user