|
|
7121b3d |
--- certbot-apache-0.9.2-orig/certbot_apache/tests/constants_test.py 2016-10-12 17:58:08.000000000 -0500
|
|
|
7121b3d |
+++ certbot-apache-0.9.2/certbot_apache/tests/constants_test.py 2016-10-13 15:22:12.138172018 -0500
|
|
|
7121b3d |
@@ -20,25 +20,25 @@
|
|
|
7121b3d |
self.assertEqual(constants.os_constant("vhost_root"),
|
|
|
7121b3d |
"/etc/httpd/conf.d")
|
|
|
7121b3d |
|
|
|
7121b3d |
+ @mock.patch("certbot.util.get_systemd_os_like")
|
|
|
7121b3d |
@mock.patch("certbot.util.get_os_info")
|
|
|
7121b3d |
- def test_get_default_value(self, os_info):
|
|
|
7121b3d |
+ def test_get_default_values(self, os_info, os_like):
|
|
|
7121b3d |
os_info.return_value = ('Nonexistent Linux', '', '')
|
|
|
7121b3d |
+ os_like.return_value = {}
|
|
|
7121b3d |
+ self.assertFalse(constants.os_constant("handle_mods"))
|
|
|
7121b3d |
+ self.assertEqual(constants.os_constant("server_root"), "/etc/apache2")
|
|
|
7121b3d |
self.assertEqual(constants.os_constant("vhost_root"),
|
|
|
7121b3d |
"/etc/apache2/sites-available")
|
|
|
7121b3d |
|
|
|
7121b3d |
+ @mock.patch("certbot.util.get_systemd_os_like")
|
|
|
7121b3d |
@mock.patch("certbot.util.get_os_info")
|
|
|
7121b3d |
- def test_get_default_constants(self, os_info):
|
|
|
7121b3d |
+ def test_get_darwin_like_values(self, os_info, os_like):
|
|
|
7121b3d |
os_info.return_value = ('Nonexistent Linux', '', '')
|
|
|
7121b3d |
- with mock.patch("certbot.util.get_systemd_os_like") as os_like:
|
|
|
7121b3d |
- # Get defaults
|
|
|
7121b3d |
- os_like.return_value = False
|
|
|
7121b3d |
- c_hm = constants.os_constant("handle_mods")
|
|
|
7121b3d |
- c_sr = constants.os_constant("server_root")
|
|
|
7121b3d |
- self.assertFalse(c_hm)
|
|
|
7121b3d |
- self.assertEqual(c_sr, "/etc/apache2")
|
|
|
7121b3d |
- # Use darwin as like test target
|
|
|
7121b3d |
- os_like.return_value = ["something", "nonexistent", "darwin"]
|
|
|
7121b3d |
- d_vr = constants.os_constant("vhost_root")
|
|
|
7121b3d |
- d_em = constants.os_constant("enmod")
|
|
|
7121b3d |
- self.assertFalse(d_em)
|
|
|
7121b3d |
- self.assertEqual(d_vr, "/etc/apache2/other")
|
|
|
7121b3d |
+ os_like.return_value = ["something", "nonexistent", "darwin"]
|
|
|
7121b3d |
+ self.assertFalse(constants.os_constant("enmod"))
|
|
|
7121b3d |
+ self.assertEqual(constants.os_constant("vhost_root"),
|
|
|
7121b3d |
+ "/etc/apache2/other")
|
|
|
7121b3d |
+
|
|
|
7121b3d |
+
|
|
|
7121b3d |
+if __name__ == "__main__":
|
|
|
7121b3d |
+ unittest.main() # pragma: no cover
|