plugin_ep.problem unittests

and some misc style things
This commit is contained in:
Peter Eckersley
2015-10-24 14:09:34 -07:00
parent 4def79d306
commit 195f36e4e1
3 changed files with 6 additions and 2 deletions
+2 -2
View File
@@ -351,8 +351,8 @@ def diagnose_configurator_problem(cfg_type, requested, plugins):
msg = "The requested {0} plugin does not appear to be installed".format(requested)
else:
msg = ("The {0} plugin is not working; there may be problems with "
"your existing configuration.\nThe error was: {1}"
.format(requested, `plugins[requested].problem`))
"your existing configuration.\nThe error was: {1!r}"
.format(requested, plugins[requested].problem))
elif cfg_type == "installer":
if os.path.exists("/etc/debian_version"):
# Debian... installers are at least possible
+1
View File
@@ -125,6 +125,7 @@ class PluginEntryPoint(object):
"""Return the Exception raised during plugin setup, or None if all is well"""
if isinstance(self._prepared, Exception):
return self._prepared
return None
@property
def available(self):
+3
View File
@@ -68,6 +68,7 @@ class PluginEntryPointTest(unittest.TestCase):
self.assertFalse(self.plugin_ep.prepared)
self.assertFalse(self.plugin_ep.misconfigured)
self.assertFalse(self.plugin_ep.available)
self.assertTrue(self.plugin_ep.problem is None)
self.assertTrue(self.plugin_ep.entry_point is EP_SA)
self.assertEqual("sa", self.plugin_ep.name)
@@ -131,6 +132,8 @@ class PluginEntryPointTest(unittest.TestCase):
errors.MisconfigurationError))
self.assertTrue(self.plugin_ep.prepared)
self.assertTrue(self.plugin_ep.misconfigured)
self.assertTrue(isinstance(self.plugin_ep.problem,
errors.MisconfigurationError))
self.assertTrue(self.plugin_ep.available)
def test_prepare_no_installation(self):