mirror of
https://github.com/certbot/certbot.git
synced 2026-06-09 00:32:12 -04:00
name_with_description -> description_with_name
This commit is contained in:
parent
771ddf0aaf
commit
a5e927c657
4 changed files with 10 additions and 9 deletions
|
|
@ -22,7 +22,7 @@ def choose_plugin(prepared, question):
|
|||
:rtype: `~.PluginEntryPoint`
|
||||
|
||||
"""
|
||||
opts = [plugin_ep.name_with_description
|
||||
opts = [plugin_ep.description_with_name
|
||||
+ (" [Misconfigured]" if plugin_ep.misconfigured else "")
|
||||
for plugin_ep in prepared]
|
||||
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ class PluginEntryPoint(object):
|
|||
return self.plugin_cls.description
|
||||
|
||||
@property
|
||||
def name_with_description(self):
|
||||
"""Name with description. Handy for UI."""
|
||||
return "{0} ({1})".format(self.name, self.description)
|
||||
def description_with_name(self):
|
||||
"""Description with name. Handy for UI."""
|
||||
return "{0} ({1})".format(self.description, self.name)
|
||||
|
||||
def ifaces(self, *ifaces_groups):
|
||||
"""Does plugin implements specified interface groups?"""
|
||||
|
|
|
|||
|
|
@ -52,9 +52,10 @@ class PluginEntryPointTest(unittest.TestCase):
|
|||
def test_description(self):
|
||||
self.assertEqual("Standalone Authenticator", self.plugin_ep.description)
|
||||
|
||||
def test_name_with_description(self):
|
||||
self.assertTrue(
|
||||
self.plugin_ep.name_with_description.startswith("sa ("))
|
||||
def test_description_with_name(self):
|
||||
self.plugin_ep.plugin_cls = mock.MagicMock(description="Desc")
|
||||
self.assertEqual(
|
||||
"Desc (sa)", self.plugin_ep.description_with_name)
|
||||
|
||||
def test_ifaces(self):
|
||||
self.assertTrue(self.plugin_ep.ifaces((interfaces.IAuthenticator,)))
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ class ChoosePluginTest(unittest.TestCase):
|
|||
def setUp(self):
|
||||
zope.component.provideUtility(display_util.FileDisplay(sys.stdout))
|
||||
self.mock_apache = mock.Mock(
|
||||
name_with_description="a", misconfigured=True)
|
||||
description_with_name="a", misconfigured=True)
|
||||
self.mock_stand = mock.Mock(
|
||||
name_with_description="s", misconfigured=False)
|
||||
description_with_name="s", misconfigured=False)
|
||||
self.mock_stand.init().more_info.return_value = "standalone"
|
||||
self.plugins = [
|
||||
self.mock_apache,
|
||||
|
|
|
|||
Loading…
Reference in a new issue