summaryrefslogtreecommitdiffstats
path: root/tests/commands
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2022-07-14 13:16:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2022-07-14 13:16:23 +0000
commiteebab08ecd6c247fa464f40934f852d63daba9bb (patch)
treeab61e7678c576d3489623464241ec67faf455964 /tests/commands
parentReleasing debian version 2.19.0-1. (diff)
downloadpre-commit-eebab08ecd6c247fa464f40934f852d63daba9bb.tar.xz
pre-commit-eebab08ecd6c247fa464f40934f852d63daba9bb.zip
Merging upstream version 2.20.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/commands')
-rw-r--r--tests/commands/hook_impl_test.py36
-rw-r--r--tests/commands/run_test.py7
2 files changed, 42 insertions, 1 deletions
diff --git a/tests/commands/hook_impl_test.py b/tests/commands/hook_impl_test.py
index 3e20874..aa321da 100644
--- a/tests/commands/hook_impl_test.py
+++ b/tests/commands/hook_impl_test.py
@@ -154,6 +154,42 @@ def test_run_ns_commit_msg():
assert ns.commit_msg_filename == '.git/COMMIT_MSG'
+def test_run_ns_prepare_commit_msg_one_arg():
+ ns = hook_impl._run_ns(
+ 'prepare-commit-msg', False,
+ ('.git/COMMIT_MSG',), b'',
+ )
+ assert ns is not None
+ assert ns.hook_stage == 'prepare-commit-msg'
+ assert ns.color is False
+ assert ns.commit_msg_filename == '.git/COMMIT_MSG'
+
+
+def test_run_ns_prepare_commit_msg_two_arg():
+ ns = hook_impl._run_ns(
+ 'prepare-commit-msg', False,
+ ('.git/COMMIT_MSG', 'message'), b'',
+ )
+ assert ns is not None
+ assert ns.hook_stage == 'prepare-commit-msg'
+ assert ns.color is False
+ assert ns.commit_msg_filename == '.git/COMMIT_MSG'
+ assert ns.prepare_commit_message_source == 'message'
+
+
+def test_run_ns_prepare_commit_msg_three_arg():
+ ns = hook_impl._run_ns(
+ 'prepare-commit-msg', False,
+ ('.git/COMMIT_MSG', 'message', 'HEAD'), b'',
+ )
+ assert ns is not None
+ assert ns.hook_stage == 'prepare-commit-msg'
+ assert ns.color is False
+ assert ns.commit_msg_filename == '.git/COMMIT_MSG'
+ assert ns.prepare_commit_message_source == 'message'
+ assert ns.commit_object_name == 'HEAD'
+
+
def test_run_ns_post_commit():
ns = hook_impl._run_ns('post-commit', True, (), b'')
assert ns is not None
diff --git a/tests/commands/run_test.py b/tests/commands/run_test.py
index 085b063..2634c0c 100644
--- a/tests/commands/run_test.py
+++ b/tests/commands/run_test.py
@@ -810,7 +810,12 @@ def test_prepare_commit_msg_hook(cap_out, store, prepare_commit_msg_repo):
cap_out,
store,
prepare_commit_msg_repo,
- {'hook_stage': 'prepare-commit-msg', 'commit_msg_filename': filename},
+ {
+ 'hook_stage': 'prepare-commit-msg',
+ 'commit_msg_filename': filename,
+ 'prepare_commit_message_source': 'commit',
+ 'commit_object_name': 'HEAD',
+ },
expected_outputs=[b'Add "Signed off by:"', b'Passed'],
expected_ret=0,
stage=False,