From d3bdf9772070d733c313c451215193567ce4e2c7 Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Wed, 24 Aug 2016 16:39:41 -0700 Subject: [PATCH] fix standalone flag test --- certbot/plugins/standalone.py | 2 +- certbot/plugins/standalone_test.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/certbot/plugins/standalone.py b/certbot/plugins/standalone.py index 1fe79e8dd..b239029ba 100644 --- a/certbot/plugins/standalone.py +++ b/certbot/plugins/standalone.py @@ -159,7 +159,7 @@ class Authenticator(common.Plugin): def add_parser_arguments(cls, add): add("supported-challenges", help="Supported challenges. Preferred in the order they are listed.", - action=supported_challenges_wrapper, dest="pref_chall") + action=supported_challenges_wrapper, default= [], dest="pref_chall") @property def supported_challenges(self): diff --git a/certbot/plugins/standalone_test.py b/certbot/plugins/standalone_test.py index b77ec0554..24b28c6eb 100644 --- a/certbot/plugins/standalone_test.py +++ b/certbot/plugins/standalone_test.py @@ -14,6 +14,8 @@ from certbot import achallenges from certbot import errors from certbot import interfaces +from certbot.plugins import disco + from certbot.tests import acme_util from certbot.tests import test_util @@ -69,14 +71,15 @@ class SupportedChallengesValidatorTest(unittest.TestCase): def setUp(self): self.parser = argparse.ArgumentParser() - from certbot.plugins import standalone - standalone.Authenticator.add_parser_arguments(self.parser.add_argument) + name = "standalone" + disco.PluginsRegistry.find_all()[name].plugin_cls.inject_parser_options( + self.parser, name) def test_standalone_flag(self): - config = self.parser.parse_args(["--supported_challenges", "http-01"]) + config = self.parser.parse_args(["--standalone-supported-challenges", + "tls-sni-01,http-01"]) http = challenges.Challenge.TYPES["http-01"] tls = challenges.Challenge.TYPES["tls-sni-01"] - print config self.assertEqual(config.pref_chall, [tls, http]) class AuthenticatorTest(unittest.TestCase):