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 /gitlint/tests/config/test_config_precedence.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 'gitlint/tests/config/test_config_precedence.py')
-rw-r--r-- | gitlint/tests/config/test_config_precedence.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/gitlint/tests/config/test_config_precedence.py b/gitlint/tests/config/test_config_precedence.py index 9689e55..a0eeccd 100644 --- a/gitlint/tests/config/test_config_precedence.py +++ b/gitlint/tests/config/test_config_precedence.py @@ -25,40 +25,48 @@ class LintConfigPrecedenceTests(BaseTestCase): def setUp(self): self.cli = CliRunner() - @patch('gitlint.cli.get_stdin_data', return_value=u"WIP\n\nThis is å test message\n") + @patch('gitlint.cli.get_stdin_data', return_value=u"WIP:fö\n\nThis is å test message\n") def test_config_precedence(self, _): # TODO(jroovers): this test really only test verbosity, we need to do some refactoring to gitlint.cli # to more easily test everything # Test that the config precedence is followed: # 1. commandline convenience flags - # 2. commandline -c flags - # 3. config file - # 4. default config + # 2. environment variables + # 3. commandline -c flags + # 4. config file + # 5. default config config_path = self.get_sample_path("config/gitlintconfig") # 1. commandline convenience flags with patch('gitlint.display.stderr', new=StringIO()) as stderr: result = self.cli.invoke(cli.cli, ["-vvv", "-c", "general.verbosity=2", "--config", config_path]) self.assertEqual(result.output, "") - self.assertEqual(stderr.getvalue(), "1: T5 Title contains the word 'WIP' (case-insensitive): \"WIP\"\n") + self.assertEqual(stderr.getvalue(), u"1: T5 Title contains the word 'WIP' (case-insensitive): \"WIP:fö\"\n") - # 2. commandline -c flags + # 2. environment variables + with patch('gitlint.display.stderr', new=StringIO()) as stderr: + result = self.cli.invoke(cli.cli, ["-c", "general.verbosity=2", "--config", config_path], + env={"GITLINT_VERBOSITY": "3"}) + self.assertEqual(result.output, "") + self.assertEqual(stderr.getvalue(), u"1: T5 Title contains the word 'WIP' (case-insensitive): \"WIP:fö\"\n") + + # 3. commandline -c flags with patch('gitlint.display.stderr', new=StringIO()) as stderr: result = self.cli.invoke(cli.cli, ["-c", "general.verbosity=2", "--config", config_path]) self.assertEqual(result.output, "") self.assertEqual(stderr.getvalue(), "1: T5 Title contains the word 'WIP' (case-insensitive)\n") - # 3. config file + # 4. config file with patch('gitlint.display.stderr', new=StringIO()) as stderr: result = self.cli.invoke(cli.cli, ["--config", config_path]) self.assertEqual(result.output, "") self.assertEqual(stderr.getvalue(), "1: T5\n") - # 4. default config + # 5. default config with patch('gitlint.display.stderr', new=StringIO()) as stderr: result = self.cli.invoke(cli.cli) self.assertEqual(result.output, "") - self.assertEqual(stderr.getvalue(), "1: T5 Title contains the word 'WIP' (case-insensitive): \"WIP\"\n") + self.assertEqual(stderr.getvalue(), u"1: T5 Title contains the word 'WIP' (case-insensitive): \"WIP:fö\"\n") @patch('gitlint.cli.get_stdin_data', return_value=u"WIP: This is å test") def test_ignore_precedence(self, get_stdin_data): |