diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2020-11-03 06:07:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2020-11-03 06:07:48 +0000 |
commit | 85812cd25d9e2f015bb71b26d51458b3718bf6c7 (patch) | |
tree | 463ad57ffbe3636e06e9bb36104fbf12938e78c1 /qa/test_gitlint.py | |
parent | Releasing debian version 0.13.1-6. (diff) | |
download | gitlint-85812cd25d9e2f015bb71b26d51458b3718bf6c7.tar.xz gitlint-85812cd25d9e2f015bb71b26d51458b3718bf6c7.zip |
Merging upstream version 0.14.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'qa/test_gitlint.py')
-rw-r--r-- | qa/test_gitlint.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/qa/test_gitlint.py b/qa/test_gitlint.py index 4762721..2e837b9 100644 --- a/qa/test_gitlint.py +++ b/qa/test_gitlint.py @@ -157,6 +157,28 @@ class IntegrationTests(BaseTestCase): self.assertEqualStdout(output, self.get_expected("test_gitlint/test_msg_filename_no_tty_1")) + def test_no_git_name_set(self): + """ Ensure we print out a helpful message if user.name is not set """ + tmp_commit_msg_file = self.create_tmpfile(u"WIP: msg-fïlename NO name test.") + # Name is checked before email so this isn't strictly + # necessary but seems good for consistency. + env = self.create_tmp_git_config(u"[user]\n email = test-emåil@foo.com\n") + output = gitlint("--staged", "--msg-filename", tmp_commit_msg_file, + _ok_code=[self.GIT_CONTEXT_ERROR_CODE], + _env=env) + expected = u"Missing git configuration: please set user.name\n" + self.assertEqualStdout(output, expected) + + def test_no_git_email_set(self): + """ Ensure we print out a helpful message if user.email is not set """ + tmp_commit_msg_file = self.create_tmpfile(u"WIP: msg-fïlename NO email test.") + env = self.create_tmp_git_config(u"[user]\n name = test åuthor\n") + output = gitlint("--staged", "--msg-filename", tmp_commit_msg_file, + _ok_code=[self.GIT_CONTEXT_ERROR_CODE], + _env=env) + expected = u"Missing git configuration: please set user.email\n" + self.assertEqualStdout(output, expected) + def test_git_errors(self): # Repo has no commits: caused by `git log` empty_git_repo = self.create_tmp_git_repo() |