cleanup errors.py use in client_test, small changes to display doc

This commit is contained in:
James Kasten 2015-01-26 14:21:37 -08:00
parent 243cc4f9fb
commit 1831062529
2 changed files with 13 additions and 7 deletions

View file

@ -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 = ""

View file

@ -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