Test prepare() failure due to missing postconf

This commit is contained in:
Brad Warren 2017-08-10 12:26:47 -07:00
parent 192f0f60da
commit dfd1cceb9b

View file

@ -12,6 +12,8 @@ import unittest
import mock
import six
from certbot import errors
# Fake Postfix Configs
names_only_config = """myhostname = mail.fubard.org
mydomain = fubard.org
@ -37,6 +39,17 @@ class TestPostfixConfigGenerator(unittest.TestCase):
for call in mock_add.call_args_list:
self.assertTrue(call[0][0] in ('config-dir', 'config-utility'))
def test_no_postconf_prepare(self):
installer = self._create_installer()
installer_path = "certbot_postfix.installer"
exe_exists_path = installer_path + ".util.exe_exists"
path_surgery_path = installer_path + ".plugins_util.path_surgery"
with mock.patch(path_surgery_path, return_value=False):
with mock.patch(exe_exists_path, return_value=False):
self.assertRaises(errors.NoInstallationError, installer.prepare)
def testGetAllNames(self):
sorted_names = ['fubard.org', 'mail.fubard.org']
with mock.patch('certbot_postfix.installer.open') as mock_open: