"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "certbot-apache/certbot_apache/tests/http_01_test.py" between
certbot-0.30.2.tar.gz and certbot-0.31.0.tar.gz

About: Certbot is EFF’s tool to obtain certs from Let’s Encrypt, and optionally auto-enable HTTPS on your server. It can also act as a client for any other CA that uses the ACME protocol.

http_01_test.py  (certbot-0.30.2):http_01_test.py  (certbot-0.31.0)
skipping to change at line 28 skipping to change at line 28
class ApacheHttp01Test(util.ApacheTest): class ApacheHttp01Test(util.ApacheTest):
"""Test for certbot_apache.http_01.ApacheHttp01.""" """Test for certbot_apache.http_01.ApacheHttp01."""
def setUp(self, *args, **kwargs): def setUp(self, *args, **kwargs):
super(ApacheHttp01Test, self).setUp(*args, **kwargs) super(ApacheHttp01Test, self).setUp(*args, **kwargs)
self.account_key = self.rsa512jwk self.account_key = self.rsa512jwk
self.achalls = [] # type: List[achallenges.KeyAuthorizationAnnotatedCha llenge] self.achalls = [] # type: List[achallenges.KeyAuthorizationAnnotatedCha llenge]
vh_truth = util.get_vh_truth( vh_truth = util.get_vh_truth(
self.temp_dir, "debian_apache_2_4/multiple_vhosts") self.temp_dir, "debian_apache_2_4/multiple_vhosts")
# Takes the vhosts for encryption-example.demo, certbot.demo, and # Takes the vhosts for encryption-example.demo, certbot.demo
# vhost.in.rootconf # and vhost.in.rootconf
self.vhosts = [vh_truth[0], vh_truth[3], vh_truth[10]] self.vhosts = [vh_truth[0], vh_truth[3], vh_truth[10]]
for i in range(NUM_ACHALLS): for i in range(NUM_ACHALLS):
self.achalls.append( self.achalls.append(
achallenges.KeyAuthorizationAnnotatedChallenge( achallenges.KeyAuthorizationAnnotatedChallenge(
challb=acme_util.chall_to_challb( challb=acme_util.chall_to_challb(
challenges.HTTP01(token=((chr(ord('a') + i).encode() * 1 6))), challenges.HTTP01(token=((chr(ord('a') + i).encode() * 1 6))),
"pending"), "pending"),
domain=self.vhosts[i].name, account_key=self.account_key)) domain=self.vhosts[i].name, account_key=self.account_key))
modules = ["rewrite", "authz_core", "authz_host"] modules = ["ssl", "rewrite", "authz_core", "authz_host"]
for mod in modules: for mod in modules:
self.config.parser.modules.add("mod_{0}.c".format(mod)) self.config.parser.modules.add("mod_{0}.c".format(mod))
self.config.parser.modules.add(mod + "_module") self.config.parser.modules.add(mod + "_module")
from certbot_apache.http_01 import ApacheHttp01 from certbot_apache.http_01 import ApacheHttp01
self.http = ApacheHttp01(self.config) self.http = ApacheHttp01(self.config)
def test_empty_perform(self): def test_empty_perform(self):
self.assertFalse(self.http.perform()) self.assertFalse(self.http.perform())
skipping to change at line 112 skipping to change at line 112
def test_anonymous_vhost(self): def test_anonymous_vhost(self):
vhosts = [v for v in self.config.vhosts if not v.ssl] vhosts = [v for v in self.config.vhosts if not v.ssl]
achalls = [ achalls = [
achallenges.KeyAuthorizationAnnotatedChallenge( achallenges.KeyAuthorizationAnnotatedChallenge(
challb=acme_util.chall_to_challb( challb=acme_util.chall_to_challb(
challenges.HTTP01(token=((b'a' * 16))), challenges.HTTP01(token=((b'a' * 16))),
"pending"), "pending"),
domain="something.nonexistent", account_key=self.account_key)] domain="something.nonexistent", account_key=self.account_key)]
self.common_perform_test(achalls, vhosts) self.common_perform_test(achalls, vhosts)
def test_configure_multiple_vhosts(self):
vhosts = [v for v in self.config.vhosts if "duplicate.example.com" in v.
get_names()]
self.assertEqual(len(vhosts), 2)
achalls = [
achallenges.KeyAuthorizationAnnotatedChallenge(
challb=acme_util.chall_to_challb(
challenges.HTTP01(token=((b'a' * 16))),
"pending"),
domain="duplicate.example.com", account_key=self.account_key)]
self.common_perform_test(achalls, vhosts)
def test_no_vhost(self): def test_no_vhost(self):
for achall in self.achalls: for achall in self.achalls:
self.http.add_chall(achall) self.http.add_chall(achall)
self.config.config.http01_port = 12345 self.config.config.http01_port = 12345
self.assertRaises(errors.PluginError, self.http.perform) self.assertRaises(errors.PluginError, self.http.perform)
def test_perform_1_achall_apache_2_2(self): def test_perform_1_achall_apache_2_2(self):
self.combinations_perform_test(num_achalls=1, minor_version=2) self.combinations_perform_test(num_achalls=1, minor_version=2)
def test_perform_1_achall_apache_2_4(self): def test_perform_1_achall_apache_2_4(self):
skipping to change at line 177 skipping to change at line 188
self.assertEqual(self.http.perform(), expected_response) self.assertEqual(self.http.perform(), expected_response)
self.assertTrue(os.path.isdir(self.http.challenge_dir)) self.assertTrue(os.path.isdir(self.http.challenge_dir))
self._has_min_permissions(self.http.challenge_dir, 0o755) self._has_min_permissions(self.http.challenge_dir, 0o755)
self._test_challenge_conf() self._test_challenge_conf()
for achall in achalls: for achall in achalls:
self._test_challenge_file(achall) self._test_challenge_file(achall)
for vhost in vhosts: for vhost in vhosts:
if not vhost.ssl: matches = self.config.parser.find_dir("Include",
matches = self.config.parser.find_dir("Include", self.http.challenge_conf_pre,
self.http.challenge_conf_p vhost.path)
re, self.assertEqual(len(matches), 1)
vhost.path) matches = self.config.parser.find_dir("Include",
self.assertEqual(len(matches), 1) self.http.challenge_conf_post,
matches = self.config.parser.find_dir("Include", vhost.path)
self.http.challenge_conf_p self.assertEqual(len(matches), 1)
ost,
vhost.path)
self.assertEqual(len(matches), 1)
self.assertTrue(os.path.exists(challenge_dir)) self.assertTrue(os.path.exists(challenge_dir))
def _test_challenge_conf(self): def _test_challenge_conf(self):
with open(self.http.challenge_conf_pre) as f: with open(self.http.challenge_conf_pre) as f:
pre_conf_contents = f.read() pre_conf_contents = f.read()
with open(self.http.challenge_conf_post) as f: with open(self.http.challenge_conf_post) as f:
post_conf_contents = f.read() post_conf_contents = f.read()
 End of changes. 4 change blocks. 
14 lines changed or deleted 23 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)