-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a lot of structural issues with the project
- Loading branch information
Showing
7 changed files
with
13 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,27 @@ | ||
import re | ||
import unittest | ||
import unittest | ||
from src.main import cli | ||
from src import commit_msg_regex_hook | ||
|
||
|
||
class TestMessageEmpty(unittest.TestCase): | ||
def test_empty_message_should_fail(self): | ||
result = cli.message_not_empty(" \n")() | ||
result = commit_msg_regex_hook.message_not_empty(" \n")() | ||
self.assertEqual(result.is_passing(), False) | ||
|
||
def test_full_message_should_pass(self): | ||
result = cli.message_not_empty("I am a whole message")() | ||
result = commit_msg_regex_hook.message_not_empty("I am a whole message")() | ||
self.assertEqual(result.is_passing(), True) | ||
|
||
|
||
class TestMessagePatternMatch(unittest.TestCase): | ||
def test_pattern_not_match(self): | ||
pattern = re.compile(r'[A-Z]{3,4}-[0-9]{3,6} \| [\w\s]* \| .+') | ||
test_str = "asefagrragadsrgasr" | ||
result = cli.message_pattern_match(test_str, pattern)() | ||
result = commit_msg_regex_hook.message_pattern_match(test_str, pattern)() | ||
self.assertEqual(result.is_passing(), False) | ||
|
||
def test_pattern_match(self): | ||
pattern = re.compile(r'[A-Z]{3,4}-[0-9]{3,6} \| [\w\s]* \| .+') | ||
test_str = "ABC-123 | David | Commit message!" | ||
result = cli.message_pattern_match(test_str, pattern)() | ||
result = commit_msg_regex_hook.message_pattern_match(test_str, pattern)() | ||
self.assertEqual(result.is_passing(), True) |