From ad4ed22932740d1c178acae485a9a9f1a9c59cc4 Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Fri, 30 Jun 2017 09:55:36 -0400 Subject: [PATCH] test --renew-hook --- certbot/tests/cli_test.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/certbot/tests/cli_test.py b/certbot/tests/cli_test.py index e76db02f7..3a943fd1a 100644 --- a/certbot/tests/cli_test.py +++ b/certbot/tests/cli_test.py @@ -40,7 +40,7 @@ class TestReadFile(TempDirTestCase): -class ParseTest(unittest.TestCase): +class ParseTest(unittest.TestCase): # pylint: disable=too-many-public-methods '''Test the cli args entrypoint''' _multiprocess_can_split_ = True @@ -336,6 +336,18 @@ class ParseTest(unittest.TestCase): self.assertEqual(namespace.deploy_hook, value) self.assertEqual(namespace.renew_hook, value) + def test_renew_hook_conflict(self): + with mock.patch("certbot.cli.sys.stderr"): + self.assertRaises(SystemExit, self.parse, + "--deploy-hook foo --renew-hook bar".split()) + + def test_renew_hook_does_not_set_renew_hook(self): + value = "foo" + namespace = self.parse( + ["--renew-hook", value, "--disable-hook-validation"]) + self.assertEqual(namespace.deploy_hook, None) + self.assertEqual(namespace.renew_hook, value) + class DefaultTest(unittest.TestCase): """Tests for certbot.cli._Default."""