mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00

This was missed during review of https://codereview.webrtc.org/3010153002 Having python2 in the shebang makes it fail presubmit locally on Mac. Disable 'invalid-name' PyLint rule in 3 places to pass presubmit. NOTRY=True NOTREECHECKS=True TBR=charujain@webrtc.org Bug: none Change-Id: I85cc5783ba11774792cd8c2f6c0b4ff47ad89270 Reviewed-on: https://webrtc-review.googlesource.com/1566 Commit-Queue: Henrik Kjellander <kjellander@webrtc.org> Reviewed-by: Patrik Höglund <phoglund@webrtc.org> Reviewed-by: Henrik Kjellander <kjellander@webrtc.org> Cr-Commit-Position: refs/heads/master@{#19850}
48 lines
1.9 KiB
Python
Executable file
48 lines
1.9 KiB
Python
Executable file
#!/usr/bin/env python
|
|
|
|
# Copyright 2017 The WebRTC project authors. All Rights Reserved.
|
|
#
|
|
# Use of this source code is governed by a BSD-style license
|
|
# that can be found in the LICENSE file in the root of the source
|
|
# tree. An additional intellectual property rights grant can be found
|
|
# in the file PATENTS. All contributing project authors may
|
|
# be found in the AUTHORS file in the root of the source tree.
|
|
|
|
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()
|