summaryrefslogtreecommitdiffstats
path: root/tests/main_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2020-08-30 11:22:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2020-08-30 11:22:53 +0000
commit6cfa8e0963e9a518a25528a248932fcf41b4f969 (patch)
tree6882a2a7a3214ef85d7a946f2506e9ed2c3f60f5 /tests/main_test.py
parentAdding upstream version 2.6.0. (diff)
downloadpre-commit-6cfa8e0963e9a518a25528a248932fcf41b4f969.tar.xz
pre-commit-6cfa8e0963e9a518a25528a248932fcf41b4f969.zip
Adding upstream version 2.7.1.upstream/2.7.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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(