From ff26c3e623fee519146b51cafe28ed8ac4d396d2 Mon Sep 17 00:00:00 2001 From: Erica Portnoy Date: Wed, 11 Mar 2020 17:35:51 -0700 Subject: [PATCH] add coverage and lint --- certbot-apache/certbot_apache/_internal/configurator.py | 2 +- certbot-apache/tests/configurator_test.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/certbot-apache/certbot_apache/_internal/configurator.py b/certbot-apache/certbot_apache/_internal/configurator.py index 8c644c265..172817547 100644 --- a/certbot-apache/certbot_apache/_internal/configurator.py +++ b/certbot-apache/certbot_apache/_internal/configurator.py @@ -242,7 +242,7 @@ class ApacheConfigurator(common.Installer): try: with open(ssl_module_location, mode="rb") as f: contents = f.read() - except IOError as error: + except IOError: return None return contents diff --git a/certbot-apache/tests/configurator_test.py b/certbot-apache/tests/configurator_test.py index 9bb9a83b4..cbeb73fec 100644 --- a/certbot-apache/tests/configurator_test.py +++ b/certbot-apache/tests/configurator_test.py @@ -1836,6 +1836,10 @@ class InstallSslOptionsConfTest(util.ApacheTest): self.assertEqual(self.config.openssl_version(), None) self.assertTrue("Could not find OpenSSL" in mock_log.call_args[0][0]) + def test_open_module_file(self): + mock_open = mock.mock_open(read_data="testing 12 3") + with mock.patch("certbot_apache._internal.configurator.open", mock_open): + self.assertEqual (self.config._open_module_file("/nonsense/"), "testing 12 3") if __name__ == "__main__": unittest.main() # pragma: no cover