summaryrefslogtreecommitdiffstats
path: root/gitlint-core/gitlint/tests/test_hooks.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-11 08:03:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-03-11 08:03:03 +0000
commitde139943d8272773b5f19ed824d687b0232b9ba3 (patch)
tree47e73755bffd41bdde2d59d76cc595f5a1fa75d4 /gitlint-core/gitlint/tests/test_hooks.py
parentAdding upstream version 0.19.0~dev. (diff)
downloadgitlint-upstream.tar.xz
gitlint-upstream.zip
Adding upstream version 0.19.1.upstream/0.19.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gitlint-core/gitlint/tests/test_hooks.py')
-rw-r--r--gitlint-core/gitlint/tests/test_hooks.py32
1 files changed, 17 insertions, 15 deletions
diff --git a/gitlint-core/gitlint/tests/test_hooks.py b/gitlint-core/gitlint/tests/test_hooks.py
index f92b148..7390f14 100644
--- a/gitlint-core/gitlint/tests/test_hooks.py
+++ b/gitlint-core/gitlint/tests/test_hooks.py
@@ -1,16 +1,15 @@
import os
+from unittest.mock import ANY, mock_open, patch
-from unittest.mock import patch, ANY, mock_open
-
-from gitlint.tests.base import BaseTestCase
from gitlint.config import LintConfig
from gitlint.hooks import (
- GitHookInstaller,
- GitHookInstallerError,
- COMMIT_MSG_HOOK_SRC_PATH,
COMMIT_MSG_HOOK_DST_PATH,
+ COMMIT_MSG_HOOK_SRC_PATH,
GITLINT_HOOK_IDENTIFIER,
+ GitHookInstaller,
+ GitHookInstallerError,
)
+from gitlint.tests.base import BaseTestCase
class HookTests(BaseTestCase):
@@ -58,9 +57,10 @@ class HookTests(BaseTestCase):
expected_msg = f"{lint_config.target} is not a git repository."
with self.assertRaisesMessage(GitHookInstallerError, expected_msg):
GitHookInstaller.install_commit_msg_hook(lint_config)
- isdir.assert_called_with(git_hooks_dir.return_value)
- path_exists.assert_not_called()
- copy.assert_not_called()
+
+ isdir.assert_called_with(git_hooks_dir.return_value)
+ path_exists.assert_not_called()
+ copy.assert_not_called()
# mock that there is already a commit hook present
isdir.return_value = True
@@ -106,9 +106,10 @@ class HookTests(BaseTestCase):
expected_msg = f"{lint_config.target} is not a git repository."
with self.assertRaisesMessage(GitHookInstallerError, expected_msg):
GitHookInstaller.uninstall_commit_msg_hook(lint_config)
- isdir.assert_called_with(git_hooks_dir.return_value)
- path_exists.assert_not_called()
- remove.assert_not_called()
+
+ isdir.assert_called_with(git_hooks_dir.return_value)
+ path_exists.assert_not_called()
+ remove.assert_not_called()
# mock that there is no commit hook present
isdir.return_value = True
@@ -117,9 +118,10 @@ class HookTests(BaseTestCase):
expected_msg = f"There is no commit-msg hook present in {expected_dst}."
with self.assertRaisesMessage(GitHookInstallerError, expected_msg):
GitHookInstaller.uninstall_commit_msg_hook(lint_config)
- isdir.assert_called_with(git_hooks_dir.return_value)
- path_exists.assert_called_once_with(expected_dst)
- remove.assert_not_called()
+
+ isdir.assert_called_with(git_hooks_dir.return_value)
+ path_exists.assert_called_once_with(expected_dst)
+ remove.assert_not_called()
# mock that there is a different (=not gitlint) commit hook
isdir.return_value = True