summaryrefslogtreecommitdiffstats
path: root/gitlint-core/gitlint/tests/test_hooks.py
diff options
context:
space:
mode:
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