| 1 | from qa.base import BaseTestCase |
| 2 | from qa.shell import gitlint |
| 3 | |
| 4 | |
| 5 | class NamedRuleTests(BaseTestCase): |
| 6 | """Integration tests for named rules.""" |
| 7 | |
| 8 | def test_named_rule(self): |
| 9 | commit_msg = "WIP: thåt dûr bår\n\nSïmple commit body" |
| 10 | self.create_simple_commit(commit_msg) |
| 11 | config_path = self.get_sample_path("config/named-rules") |
| 12 | output = gitlint("--config", config_path, _cwd=self.tmp_git_repo, _tty_in=True, _ok_code=[5]) |
| 13 | self.assertEqualStdout(output, self.get_expected("test_named_rules/test_named_rule_1")) |
| 14 | |
| 15 | def test_named_user_rule(self): |
| 16 | commit_msg = "Normal cömmit title\n\nSïmple commit message body" |
| 17 | self.create_simple_commit(commit_msg) |
| 18 | config_path = self.get_sample_path("config/named-user-rules") |
| 19 | extra_path = self.get_sample_path("user_rules/extra") |
| 20 | output = gitlint( |
| 21 | "--extra-path", extra_path, "--config", config_path, _cwd=self.tmp_git_repo, _tty_in=True, _ok_code=[9] |
| 22 | ) |
| 23 | self.assertEqualStdout(output, self.get_expected("test_named_rules/test_named_user_rule_1")) |