OLD | NEW |
---|---|
(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): | |
ehmaldonado_webrtc
2017/09/06 18:50:55
Check that BUG=None works
kjellander_webrtc
2017/09/07 08:28:15
Thanks for remembering this. It would be annoying
| |
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 | |
kjellander_webrtc
2017/09/06 18:42:08
nit: +1 blank line
| |
28 if __name__ == '__main__': | |
29 unittest.main() | |
OLD | NEW |