From 1b65ba88d8f86a96b1e231ae657e39e69588c631 Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Fri, 30 Jun 2017 10:30:33 -0400 Subject: [PATCH] test hooks.deploy_hook --- certbot/tests/hook_test.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/certbot/tests/hook_test.py b/certbot/tests/hook_test.py index fe2579a89..28417ac73 100644 --- a/certbot/tests/hook_test.py +++ b/certbot/tests/hook_test.py @@ -36,6 +36,19 @@ class HookTest(unittest.TestCase): self.assertEqual(hooks._prog("funky"), None) self.assertEqual(mock_ps.call_count, 1) + @mock.patch('certbot.hooks.renew_hook') + def test_deploy_hook(self, mock_renew_hook): + args = (mock.Mock(deploy_hook='foo'), ['example.org'], 'path',) + # pylint: disable=star-args + hooks.deploy_hook(*args) + mock_renew_hook.assert_called_once_with(*args) + + @mock.patch('certbot.hooks.renew_hook') + def test_no_deploy_hook(self, mock_renew_hook): + args = (mock.Mock(deploy_hook=None), ['example.org'], 'path',) + hooks.deploy_hook(*args) # pylint: disable=star-args + mock_renew_hook.assert_not_called() + def _test_a_hook(self, config, hook_function, calls_expected, **kwargs): with mock.patch('certbot.hooks.logger') as mock_logger: mock_logger.warning = mock.MagicMock()