Skip to content

Commit

Permalink
Test hook validation order
Browse files Browse the repository at this point in the history
  • Loading branch information
bmw committed Jun 30, 2017
1 parent 4c19d19 commit 62327b4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions certbot/tests/hook_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ def test_validate_hooks(self, mock_prog):
config = mock.MagicMock(pre_hook="explodinator", post_hook="", renew_hook="")
self.assertRaises(errors.HookCommandNotFound, hooks.validate_hooks, config)

@mock.patch('certbot.hooks.validate_hook')
def test_validation_order(self, mock_validate_hook):
# This ensures error messages are about deploy hook when appropriate
config = mock.Mock(deploy_hook=None, pre_hook=None,
post_hook=None, renew_hook=None)
hooks.validate_hooks(config)

order = [call[0][1] for call in mock_validate_hook.call_args_list]
self.assertTrue('pre' in order)
self.assertTrue('post' in order)
self.assertTrue('deploy' in order)
self.assertEqual(order[-1], 'renew')

@mock.patch('certbot.hooks.util.exe_exists')
@mock.patch('certbot.hooks.plug_util.path_surgery')
def test_prog(self, mock_ps, mock_exe_exists):
Expand Down

0 comments on commit 62327b4

Please sign in to comment.