|
1 | 1 | import re |
2 | 2 | import unittest |
3 | | -import unittest |
4 | | -from src.main import cli |
| 3 | +from src import commit_msg_regex_hook |
5 | 4 |
|
6 | 5 |
|
7 | 6 | class TestMessageEmpty(unittest.TestCase): |
8 | 7 | def test_empty_message_should_fail(self): |
9 | | - result = cli.message_not_empty(" \n")() |
| 8 | + result = commit_msg_regex_hook.message_not_empty(" \n")() |
10 | 9 | self.assertEqual(result.is_passing(), False) |
11 | 10 |
|
12 | 11 | def test_full_message_should_pass(self): |
13 | | - result = cli.message_not_empty("I am a whole message")() |
| 12 | + result = commit_msg_regex_hook.message_not_empty("I am a whole message")() |
14 | 13 | self.assertEqual(result.is_passing(), True) |
15 | 14 |
|
16 | 15 |
|
17 | 16 | class TestMessagePatternMatch(unittest.TestCase): |
18 | 17 | def test_pattern_not_match(self): |
19 | 18 | pattern = re.compile(r'[A-Z]{3,4}-[0-9]{3,6} \| [\w\s]* \| .+') |
20 | 19 | test_str = "asefagrragadsrgasr" |
21 | | - result = cli.message_pattern_match(test_str, pattern)() |
| 20 | + result = commit_msg_regex_hook.message_pattern_match(test_str, pattern)() |
22 | 21 | self.assertEqual(result.is_passing(), False) |
23 | 22 |
|
24 | 23 | def test_pattern_match(self): |
25 | 24 | pattern = re.compile(r'[A-Z]{3,4}-[0-9]{3,6} \| [\w\s]* \| .+') |
26 | 25 | test_str = "ABC-123 | David | Commit message!" |
27 | | - result = cli.message_pattern_match(test_str, pattern)() |
| 26 | + result = commit_msg_regex_hook.message_pattern_match(test_str, pattern)() |
28 | 27 | self.assertEqual(result.is_passing(), True) |
0 commit comments