Test for CLI --webroot-map parsing

This commit is contained in:
Peter Eckersley
2015-11-21 11:23:53 -08:00
parent 3cc8e7e019
commit 5beccc080d
+6 -1
View File
@@ -341,11 +341,12 @@ class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods
namespace = cli.prepare_and_parse_args(plugins, long_args)
self.assertEqual(namespace.domains, ['example.com', 'another.net'])
def test_parse_webroot(self):
plugins = disco.PluginsRegistry.find_all()
webroot_args = ['--webroot', '-d', 'stray.example.com', '-w',
'/var/www/example', '-d', 'example.com,www.example.com', '-w',
'/var/www/superfluous', '-d', 'superfluo.us', '-d', 'www.superfluo.us']
namespace = cli.prepare_and_parse_args(plugins, webroot_args)
open("/tmp/frogs", "w").write("%r" % namespace)
self.assertEqual(namespace.webroot_map, {
'example.com' : '/var/www/example',
'stray.example.com' : '/var/www/example',
@@ -353,6 +354,10 @@ class CLITest(unittest.TestCase): # pylint: disable=too-many-public-methods
'www.superfluo.us' : '/var/www/superfluous',
'superfluo.us' : '/var/www/superfluous'})
webroot_map_args = ['--webroot-map', '{"eg.com" : "/tmp"}']
namespace = cli.prepare_and_parse_args(plugins, webroot_map_args)
self.assertEqual(namespace.webroot_map, {u"eg.com" : u"/tmp"})
@mock.patch('letsencrypt.crypto_util.notAfter')
@mock.patch('letsencrypt.cli.zope.component.getUtility')
def test_certonly_new_request_success(self, mock_get_utility, mock_notAfter):