fixed failing tests for changes that allow apache22

This commit is contained in:
Noah Swartz 2015-12-09 17:05:38 -08:00
parent 1bf9fbcc72
commit 0a1b9c2bf0
4 changed files with 17 additions and 6 deletions

View file

@ -107,7 +107,6 @@ class ApacheParser(object):
except ValueError:
self.unparsable = True
return
#raise errors.PluginError("Unable to parse runtime variables")
for match in matches:
if match.count("=") > 1:

View file

@ -28,10 +28,18 @@ class TwoVhost80Test(util.ApacheTest):
self.config = util.get_apache_configurator(
self.config_path, self.config_dir, self.work_dir)
self.config = self.mock_deploy_cert(self.config)
self.vh_truth = util.get_vh_truth(
self.temp_dir, "debian_apache_2_4/two_vhost_80")
def mock_deploy_cert(self, config):
self.config.real_deploy_cert = self.config.deploy_cert
def mocked_deploy_cert(*args, **kwargs):
with mock.patch("letsencrypt_apache.configurator.ApacheConfigurator.enable_mod") as mock_enable:
config.real_deploy_cert(*args, **kwargs)
self.config.deploy_cert = mocked_deploy_cert
return self.config
def tearDown(self):
shutil.rmtree(self.temp_dir)
shutil.rmtree(self.config_dir)
@ -245,6 +253,7 @@ class TwoVhost80Test(util.ApacheTest):
# Get the default 443 vhost
self.config.assoc["random.demo"] = self.vh_truth[1]
self.config = self.mock_deploy_cert(self.config)
self.config.deploy_cert(
"random.demo", "example/cert.pem", "example/key.pem",
"example/cert_chain.pem", "example/fullchain.pem")
@ -271,6 +280,7 @@ class TwoVhost80Test(util.ApacheTest):
def test_deploy_cert_newssl_no_fullchain(self):
self.config = util.get_apache_configurator(
self.config_path, self.config_dir, self.work_dir, version=(2, 4, 16))
self.config = self.mock_deploy_cert(self.config)
self.config.parser.modules.add("ssl_module")
self.config.parser.modules.add("mod_ssl.c")
@ -284,6 +294,7 @@ class TwoVhost80Test(util.ApacheTest):
def test_deploy_cert_old_apache_no_chain(self):
self.config = util.get_apache_configurator(
self.config_path, self.config_dir, self.work_dir, version=(2, 4, 7))
self.config = self.mock_deploy_cert(self.config)
self.config.parser.modules.add("ssl_module")
self.config.parser.modules.add("mod_ssl.c")

View file

@ -150,9 +150,9 @@ class BasicParserTest(util.ParserTest):
@mock.patch("letsencrypt_apache.parser.ApacheParser._get_runtime_cfg")
def test_update_runtime_vars_bad_output(self, mock_cfg):
mock_cfg.return_value = "Define: TLS=443=24"
self.assertRaises(
errors.PluginError, self.parser.update_runtime_variables, "ctl")
#mock_cfg.return_value = "Define: TLS=443=24"
#self.assertRaises(
# errors.PluginError, self.parser.update_runtime_variables, "ctl")
mock_cfg.return_value = "Define: DUMP_RUN_CFG\nDefine: TLS=443=24"
self.assertRaises(

View file

@ -78,7 +78,8 @@ class TlsSniPerformTest(util.ApacheTest):
# pylint: disable=protected-access
self.sni._setup_challenge_cert = mock_setup_cert
sni_responses = self.sni.perform()
with mock.patch("letsencrypt_apache.configurator.ApacheConfigurator.enable_mod") as mock_enable:
sni_responses = self.sni.perform()
self.assertEqual(mock_setup_cert.call_count, 2)