diff --git a/certbot/tests/cli_test.py b/certbot/tests/cli_test.py index 2c6e32705..fdfb9dcc8 100644 --- a/certbot/tests/cli_test.py +++ b/certbot/tests/cli_test.py @@ -423,6 +423,18 @@ class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods namespace = parse(long_args) self.assertEqual(namespace.domains, ['example.com', 'another.net']) + def test_preferred_challenges(self): + from acme.challenges import HTTP01, TLSSNI01, DNS01 + parse = self._get_argument_parser() + + short_args = ['--preferred-challenges', 'http, tls-sni-01, dns'] + namespace = parse(short_args) + + self.assertEqual(namespace.pref_challs, [HTTP01, TLSSNI01, DNS01]) + + short_args = ['--preferred-challenges', 'jumping-over-the-moon'] + self.assertRaises(argparse.ArgumentTypeError, parse, short_args) + def test_server_flag(self): parse = self._get_argument_parser() namespace = parse('--server example.com'.split())