summaryrefslogtreecommitdiffstats
path: root/tests/main_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/main_test.py')
-rw-r--r--tests/main_test.py21
1 files changed, 21 insertions, 0 deletions
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(