2015-12-07 06:37:58 -05:00
|
|
|
"""Test for letsencrypt_apache.configurator."""
|
|
|
|
|
|
2015-12-07 06:16:48 -05:00
|
|
|
import mock
|
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
|
|
from letsencrypt_apache import constants
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ConstantsTest(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
@mock.patch("letsencrypt.le_util.get_os_info")
|
|
|
|
|
def test_get_debian_value(self, os_info):
|
2015-12-07 06:37:58 -05:00
|
|
|
os_info.return_value = ('Debian', '', '')
|
2015-12-28 07:03:50 -05:00
|
|
|
self.assertEqual(constants.os_constant("vhost_root"),
|
|
|
|
|
"/etc/apache2/sites-available")
|
2015-12-07 06:16:48 -05:00
|
|
|
|
|
|
|
|
@mock.patch("letsencrypt.le_util.get_os_info")
|
|
|
|
|
def test_get_centos_value(self, os_info):
|
2015-12-07 06:37:58 -05:00
|
|
|
os_info.return_value = ('CentOS Linux', '', '')
|
2015-12-28 07:03:50 -05:00
|
|
|
self.assertEqual(constants.os_constant("vhost_root"),
|
|
|
|
|
"/etc/httpd/conf.d")
|
2015-12-07 06:16:48 -05:00
|
|
|
|
|
|
|
|
@mock.patch("letsencrypt.le_util.get_os_info")
|
|
|
|
|
def test_get_default_value(self, os_info):
|
2015-12-07 06:37:58 -05:00
|
|
|
os_info.return_value = ('Nonexistent Linux', '', '')
|
2015-12-28 07:03:50 -05:00
|
|
|
self.assertEqual(constants.os_constant("vhost_root"),
|
|
|
|
|
"/etc/apache2/sites-available")
|