add coverage and lint

This commit is contained in:
Erica Portnoy 2020-03-11 17:35:51 -07:00
parent 01177bf315
commit ff26c3e623
2 changed files with 5 additions and 1 deletions

View file

@ -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

View file

@ -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