From 36432e35f728d28d4f772f3f139558325bf80545 Mon Sep 17 00:00:00 2001 From: Peter Eckersley Date: Fri, 16 Oct 2015 18:19:22 -0700 Subject: [PATCH] keep cover happy --- letsencrypt/tests/cli_test.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/letsencrypt/tests/cli_test.py b/letsencrypt/tests/cli_test.py index f690e77f9..42faad245 100644 --- a/letsencrypt/tests/cli_test.py +++ b/letsencrypt/tests/cli_test.py @@ -15,6 +15,7 @@ from letsencrypt import errors from letsencrypt.tests import renewer_test from letsencrypt.tests import test_util +from letsencrypt.plugins import disco CSR = test_util.vector_path('csr.der') @@ -75,7 +76,6 @@ class CLITest(unittest.TestCase): output.truncate(0) self.assertRaises(SystemExit, self._call_stdout, ['-h', 'nginx']) out = output.getvalue() - from letsencrypt.plugins import disco if "nginx" in disco.PluginsRegistry.find_all(): # may be false while building distributions without plugins self.assertTrue("--nginx-ctl" in out) @@ -93,6 +93,20 @@ class CLITest(unittest.TestCase): from letsencrypt import cli self.assertTrue(cli.USAGE in out) + def test_configurator_selection(self): + output = StringIO.StringIO() + plugins = disco.PluginsRegistry.find_all() + if "apache" in plugins: + + with mock.patch('letsencrypt.cli.sys.stdout', new=output): + self.assertRaises(SystemExit, self._call_stdout, + ['--agree-eula', '--apache', '--authenticator', 'standalone']) + #import sys + #sys.stderr.write(repr(self._call_stdout(['--agree-eula', '--apache', '--authenticator', 'standalone']))) + out = output.getvalue() + self.assertTrue("Too many flags setting" in out) + # TODO add tests with a broken plugin, a missing plugin, etc + def test_rollback(self): _, _, _, client = self._call(['rollback']) self.assertEqual(1, client.rollback.call_count)