Fix issue with suggest_unsafe undeclared (#3685)

Added missing declaration of support_unsafe and unit test to prevent
regression.

Issue #3672
This commit is contained in:
Jay Faulkner 2016-10-24 14:51:50 -07:00 committed by Brad Warren
parent d54cb76432
commit 98911d0c3c
2 changed files with 9 additions and 0 deletions

View file

@ -37,6 +37,7 @@ def get_email(invalid=False, optional=True):
if optional:
if invalid:
msg += unsafe_suggestion
suggest_unsafe = False
else:
suggest_unsafe = True
else:

View file

@ -72,6 +72,14 @@ class GetEmailTest(unittest.TestCase):
self.assertTrue(
"--register-unsafely-without-email" not in call[0][0])
def test_optional_invalid_unsafe(self):
invalid_txt = "There seem to be problems"
self.input.return_value = (display_util.OK, "foo@bar.baz")
with mock.patch("certbot.display.ops.util.safe_email") as mock_safe_email:
mock_safe_email.side_effect = [False, True]
self._call(invalid=True)
self.assertTrue(invalid_txt in self.input.call_args[0][0])
class ChooseAccountTest(unittest.TestCase):
"""Tests for certbot.display.ops.choose_account."""