diff --git a/letsencrypt/client/display.py b/letsencrypt/client/display.py index fa8b43ce3..aad1d2be8 100644 --- a/letsencrypt/client/display.py +++ b/letsencrypt/client/display.py @@ -61,7 +61,7 @@ class NcursesDisplay(CommonDisplayMixin): """Display a menu. :param str message: title of menu - :param choices: Menu lines + :param choices: menu lines :type choices: list of tuples (tag, item) or list of items (tags will be enumerated) @@ -392,10 +392,16 @@ class FileDisplay(CommonDisplayMixin): self.outfile.write("\nCertificate Information:\n") self.outfile.write(cert_info_frame(cert)) + # Display exit codes OK = "ok" +"""Display exit code indicating user acceptance""" + CANCEL = "cancel" +"""Display exit code for a user canceling the display""" + HELP = "help" +"""Display exit code when for when the user requests more help.""" def cert_info_frame(cert): @@ -425,6 +431,7 @@ def gen_https_names(domains): """Returns a string of the https domains. Domains are formatted nicely with https:// prepended to each. + .. todo:: This should not use +=, rewrite this with unittests """ result = "" diff --git a/letsencrypt/client/tests/client_test.py b/letsencrypt/client/tests/client_test.py index 8e29d53c8..3c1096b34 100644 --- a/letsencrypt/client/tests/client_test.py +++ b/letsencrypt/client/tests/client_test.py @@ -3,6 +3,8 @@ import unittest import mock +from letsencrypt.client import errors + class RollbackTest(unittest.TestCase): """Test the rollback function.""" @@ -27,8 +29,7 @@ class RollbackTest(unittest.TestCase): @mock.patch("letsencrypt.client.reverter.Reverter") @mock.patch("letsencrypt.client.client.determine_installer") def test_misconfiguration_fixed(self, mock_det, mock_rev, mock_input): - from letsencrypt.client.errors import LetsEncryptMisconfigurationError - mock_det.side_effect = [LetsEncryptMisconfigurationError, + mock_det.side_effect = [errors.LetsEncryptMisconfigurationError, self.m_install] mock_input().generic_yesno.return_value = True @@ -47,8 +48,7 @@ class RollbackTest(unittest.TestCase): @mock.patch("letsencrypt.client.client.determine_installer") def test_misconfiguration_remains( self, mock_det, mock_rev, mock_warn, mock_input): - from letsencrypt.client.errors import LetsEncryptMisconfigurationError - mock_det.side_effect = LetsEncryptMisconfigurationError + mock_det.side_effect = errors.LetsEncryptMisconfigurationError mock_input().generic_yesno.return_value = True @@ -68,8 +68,7 @@ class RollbackTest(unittest.TestCase): @mock.patch("letsencrypt.client.client.determine_installer") def test_user_decides_to_manually_investigate( self, mock_det, mock_rev, mock_input): - from letsencrypt.client.errors import LetsEncryptMisconfigurationError - mock_det.side_effect = LetsEncryptMisconfigurationError + mock_det.side_effect = errors.LetsEncryptMisconfigurationError mock_input().generic_yesno.return_value = False