Commit 309bed7d authored by heroinedor's avatar heroinedor

test: added some more unit tests

parent f72ada6d
......@@ -8,7 +8,8 @@ from commit_parser.parser import TYPES
class TestParser(unittest.TestCase):
def test_parse_commit_message(self):
self.assertRaises(semantic_release.errors.UnknownCommitMessageStyleError, commit_parser.parser.parse_commit_message, ("my dummy commit message"))
with self.assertRaises(semantic_release.errors.UnknownCommitMessageStyleError):
commit_parser.parser.parse_commit_message("my dummy commit message")
def test_parse_commit_message_other_type(self):
result = commit_parser.parser.parse_commit_message("test: trigger pipeline")
......@@ -21,19 +22,34 @@ class TestParser(unittest.TestCase):
self.assertEqual(result, expected)
def test_parse_commit_message_minor_type(self):
result = commit_parser.parser.parse_commit_message("minor: trigger pipeline")
expected = (2, TYPES['minor'], '', ("trigger pipeline", '',''))
result = commit_parser.parser.parse_commit_message("minor: add multi provider login")
expected = (2, TYPES['minor'], '', ("add multi provider login", '',''))
self.assertEqual(result, expected)
@unittest.skip("demonstrating skipping")
def test_nothing(self):
self.fail("shouldn't happen")
def test_parse_commit_message_feature_type(self):
result = commit_parser.parser.parse_commit_message("feature: settings attributs are now passed to element")
expected = (1, TYPES['feature'], '', ("settings attributs are now passed to element", '', ''))
self.assertEqual(result, expected)
def test_parse_commit_message_update_type(self):
result = commit_parser.parser.parse_commit_message("update: this is an update")
expected = (1, TYPES['update'], '', ("this is an update", '', ''))
self.assertEqual(result, expected)
@unittest.skipUnless(sys.platform.startswith("win"), "requires Windows")
def test_windows_support(self):
# windows specific testing code
pass
def test_parse_commit_message_bugfix_type(self):
result = commit_parser.parser.parse_commit_message("bugfix: this is a bugfix")
expected = (1, TYPES['bugfix'], '', ("this is a bugfix", '', ''))
self.assertEqual(result, expected)
def test_parse_commit_message_ui_type(self):
result = commit_parser.parser.parse_commit_message("ui: here comes the new UI")
expected = (1, TYPES['ui'], '', ("here comes the new UI", '', ''))
self.assertEqual(result, expected)
def test_parse_commit_message_syntax_type(self):
result = commit_parser.parser.parse_commit_message("syntax: just a typo !")
expected = (1, TYPES['syntax'], '', ("just a typo !", '', ''))
self.assertEqual(result, expected)
if __name__ == '__main__':
unittest.main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment