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

Side by Side Diff: PRESUBMIT_test.py

Issue 3010153002: PRESUBMIT: Enforce tracker prefix for all BUG entries (Closed)
Patch Set: Corrected test case Created 3 years, 3 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 unified diff | Download patch
« no previous file with comments | « PRESUBMIT.py ('k') | PRESUBMIT_test_mocks.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 import unittest
2
3 import PRESUBMIT
4 from PRESUBMIT_test_mocks import MockInputApi, MockOutputApi
5
6
7 class CheckBugEntryField(unittest.TestCase):
8 def testCommitMessageBugEntryWithNoError(self):
9 mock_input_api = MockInputApi()
10 mock_output_api = MockOutputApi()
11 mock_input_api.change.BUG = 'webrtc:1234'
12 errors = PRESUBMIT._CheckCommitMessageBugEntry(mock_input_api,
13 mock_output_api)
14 self.assertEqual(0, len(errors))
15
16 def testCommitMessageBugEntryReturnError(self):
17 mock_input_api = MockInputApi()
18 mock_output_api = MockOutputApi()
19 mock_input_api.change.BUG = 'webrtc:1234,webrtc=4321'
20 errors = PRESUBMIT._CheckCommitMessageBugEntry(mock_input_api,
21 mock_output_api)
22 self.assertEqual(1, len(errors))
23 self.assertEqual(('Bogus BUG entry: webrtc=4321. Please specify'
24 ' the issue tracker prefix and the issue number,'
25 ' separated by a colon, e.g. webrtc:123 or'
26 ' chromium:12345.'), str(errors[0]))
27
28 def testCommitMessageButEntryReturnErrorWhenBugIsNone(self):
kjellander_webrtc 2017/09/08 13:07:32 testCommitMessageBugEntryIsNone
29 mock_input_api = MockInputApi()
30 mock_output_api = MockOutputApi()
31 mock_input_api.change.BUG = 'None'
32 errors = PRESUBMIT._CheckCommitMessageBugEntry(mock_input_api,
33 mock_output_api)
34 self.assertEqual(0, len(errors))
35
36
37 if __name__ == '__main__':
38 unittest.main()
39
OLDNEW
« no previous file with comments | « PRESUBMIT.py ('k') | PRESUBMIT_test_mocks.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698