1
0
mirror of https://github.com/certbot/certbot.git synced 2026-01-21 19:01:07 +03:00

--webroot-root -> --webroot-path

This commit is contained in:
Jakub Warmuz
2015-10-04 09:15:17 +00:00
parent d88455a1b9
commit 63c080b05f
2 changed files with 18 additions and 18 deletions

View File

@@ -29,11 +29,11 @@ system. It expects that there is some other HTTP server configured
to serve all files under specified web root ({0})."""
def more_info(self): # pylint: disable=missing-docstring,no-self-use
return self.MORE_INFO.format(self.conf("root"))
return self.MORE_INFO.format(self.conf("path"))
@classmethod
def add_parser_arguments(cls, add):
add("root", help="public_html / webroot path")
add("path", help="public_html / webroot path")
def get_chall_pref(self, domain): # pragma: no cover
# pylint: disable=missing-docstring,no-self-use,unused-argument
@@ -44,15 +44,15 @@ to serve all files under specified web root ({0})."""
self.full_root = None
def prepare(self): # pylint: disable=missing-docstring
root = self.conf("root")
if root is None:
path = self.conf("path")
if path is None:
raise errors.PluginError("--{0} must be set".format(
self.option_name("root")))
if not os.path.isdir(root):
self.option_name("path")))
if not os.path.isdir(path):
raise errors.PluginError(
root + " does not exist or is not a directory")
path + " does not exist or is not a directory")
self.full_root = os.path.join(
root, challenges.SimpleHTTPResponse.URI_ROOT_PATH)
path, challenges.SimpleHTTPResponse.URI_ROOT_PATH)
logger.debug("Creating root challenges validation dir at %s",
self.full_root)

View File

@@ -26,21 +26,21 @@ class AuthenticatorTest(unittest.TestCase):
def setUp(self):
from letsencrypt.plugins.webroot import Authenticator
self.root = tempfile.mkdtemp()
self.path = tempfile.mkdtemp()
self.validation_path = os.path.join(
self.root, ".well-known", "acme-challenge",
self.path, ".well-known", "acme-challenge",
"ZXZhR3hmQURzNnBTUmIyTEF2OUlaZjE3RHQzanV4R0orUEN0OTJ3citvQQ")
self.config = mock.MagicMock(webroot_root=self.root)
self.config = mock.MagicMock(webroot_path=self.path)
self.auth = Authenticator(self.config, "webroot")
self.auth.prepare()
def tearDown(self):
shutil.rmtree(self.root)
shutil.rmtree(self.path)
def test_more_info(self):
more_info = self.auth.more_info()
self.assertTrue(isinstance(more_info, str))
self.assertTrue(self.root in more_info)
self.assertTrue(self.path in more_info)
def test_add_parser_arguments(self):
add = mock.MagicMock()
@@ -48,11 +48,11 @@ class AuthenticatorTest(unittest.TestCase):
self.assertEqual(1, add.call_count)
def test_prepare_bad_root(self):
self.config.webroot_root = os.path.join(self.root, "null")
self.config.webroot_path = os.path.join(self.path, "null")
self.assertRaises(errors.PluginError, self.auth.prepare)
def test_prepare_missing_root(self):
self.config.webroot_root = None
self.config.webroot_path = None
self.assertRaises(errors.PluginError, self.auth.prepare)
def test_prepare_full_root_exists(self):
@@ -60,10 +60,10 @@ class AuthenticatorTest(unittest.TestCase):
self.auth.prepare() # shouldn't raise any exceptions
def test_prepare_reraises_other_errors(self):
self.auth.full_root = os.path.join(self.root, "null")
os.chmod(self.root, 0o000)
self.auth.full_path = os.path.join(self.path, "null")
os.chmod(self.path, 0o000)
self.assertRaises(errors.PluginError, self.auth.prepare)
os.chmod(self.root, 0o700)
os.chmod(self.path, 0o700)
def test_perform_cleanup(self):
responses = self.auth.perform([self.achall])