From 6cfa8e0963e9a518a25528a248932fcf41b4f969 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 30 Aug 2020 13:22:53 +0200 Subject: Adding upstream version 2.7.1. Signed-off-by: Daniel Baumann --- tests/main_test.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/main_test.py') diff --git a/tests/main_test.py b/tests/main_test.py index c472476..f7abeeb 100644 --- a/tests/main_test.py +++ b/tests/main_test.py @@ -159,7 +159,28 @@ def test_try_repo(mock_store_dir): def test_init_templatedir(mock_store_dir): with mock.patch.object(main, 'init_templatedir') as patch: main.main(('init-templatedir', 'tdir')) + + assert patch.call_count == 1 + assert 'tdir' in patch.call_args[0] + assert patch.call_args[1]['hook_types'] == ['pre-commit'] + assert patch.call_args[1]['skip_on_missing_config'] is True + + +def test_init_templatedir_options(mock_store_dir): + args = ( + 'init-templatedir', + 'tdir', + '--hook-type', + 'commit-msg', + '--no-allow-missing-config', + ) + with mock.patch.object(main, 'init_templatedir') as patch: + main.main(args) + assert patch.call_count == 1 + assert 'tdir' in patch.call_args[0] + assert patch.call_args[1]['hook_types'] == ['commit-msg'] + assert patch.call_args[1]['skip_on_missing_config'] is False def test_help_cmd_in_empty_directory( -- cgit v1.2.3