forked from JumpingYang001/webrtc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PRESUBMIT: Enforce tracker prefix for all BUG entries
Changed function definition from private to public. This was needed to test the function and to maintain the consistency. BUG=webrtc:8197 NOTRY=True [email protected] Review-Url: https://codereview.webrtc.org/3010153002 . Cr-Commit-Position: refs/heads/master@{#19831}
- Loading branch information
charujain
committed
Sep 14, 2017
1 parent
66ca7e3
commit 9893e25
Showing
4 changed files
with
162 additions
and
46 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
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import unittest | ||
|
||
import PRESUBMIT | ||
from presubmit_test_mocks import MockInputApi, MockOutputApi | ||
|
||
|
||
class CheckBugEntryField(unittest.TestCase): | ||
def testCommitMessageBugEntryWithNoError(self): | ||
mock_input_api = MockInputApi() | ||
mock_output_api = MockOutputApi() | ||
mock_input_api.change.BUG = 'webrtc:1234' | ||
errors = PRESUBMIT.CheckCommitMessageBugEntry(mock_input_api, | ||
mock_output_api) | ||
self.assertEqual(0, len(errors)) | ||
|
||
def testCommitMessageBugEntryReturnError(self): | ||
mock_input_api = MockInputApi() | ||
mock_output_api = MockOutputApi() | ||
mock_input_api.change.BUG = 'webrtc:1234,webrtc=4321' | ||
errors = PRESUBMIT.CheckCommitMessageBugEntry(mock_input_api, | ||
mock_output_api) | ||
self.assertEqual(1, len(errors)) | ||
self.assertEqual(('Bogus BUG entry: webrtc=4321. Please specify' | ||
' the issue tracker prefix and the issue number,' | ||
' separated by a colon, e.g. webrtc:123 or' | ||
' chromium:12345.'), str(errors[0])) | ||
|
||
def testCommitMessageBugEntryIsNone(self): | ||
mock_input_api = MockInputApi() | ||
mock_output_api = MockOutputApi() | ||
mock_input_api.change.BUG = 'None' | ||
errors = PRESUBMIT.CheckCommitMessageBugEntry(mock_input_api, | ||
mock_output_api) | ||
self.assertEqual(0, len(errors)) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() | ||
|
Oops, something went wrong.