fix standalone flag test

This commit is contained in:
Brad Warren 2016-08-24 16:39:41 -07:00
parent 51afe06ff7
commit d3bdf97720
2 changed files with 8 additions and 5 deletions

View file

@ -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):

View file

@ -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):