Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: infra/services/bugdroid/test/log_parser_test.py

Issue 2030003003: Make new bugdroid recognize git footer Bug: 123. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: add no cover Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « infra/services/bugdroid/test/__init__.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra/services/bugdroid/test/log_parser_test.py
diff --git a/infra/services/bugdroid/test/log_parser_test.py b/infra/services/bugdroid/test/log_parser_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..60714c7a98d4319d686fc2eb504371010feb8e01
--- /dev/null
+++ b/infra/services/bugdroid/test/log_parser_test.py
@@ -0,0 +1,37 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import unittest
+
+import infra.services.bugdroid.log_parser as log_parser
+
+
+class BugLineParserTest(unittest.TestCase):
+ def test_matching_bug(self):
+ for bug, bug_line in [
+ # Keep distinct bug numbers for easy search in case of test failures.
+ (123, 'BUG=123'),
+ (124, 'Bug: 124'),
+ ('chromium:125', 'Bugs: chromium:125'),
+ ]:
+ m = log_parser.BUG_LINE_REGEX.match(bug_line)
+ self.assertIsNotNone(m, '"%s" line must be matched' % bug_line)
+ self.assertEqual(m.groups()[-1], str(bug),
+ '"%s" line matched to %s but %s expected.' % (
+ bug_line, m.groups()[-1], str(bug)))
+
+ def test_not_matching_bug(self):
+ for bug_line in [
+ # Keep distinct bug numbers for easy search in case of test failures.
+ 'BUGr=123',
+ 'BUGS/124',
+ 'someBugs:',
+ ]:
+ m = log_parser.BUG_LINE_REGEX.match(bug_line)
+ self.assertIsNone(m, '"%s" line must not be matched (got %s)' %
+ (bug_line, m.groups()) if m else None)
+
+
+if __name__ == "__main__":
+ unittest.main()
« no previous file with comments | « infra/services/bugdroid/test/__init__.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698