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

Side by Side Diff: presubmit_test_mocks.py

Issue 3010153002: PRESUBMIT: Enforce tracker prefix for all BUG entries (Closed)
Patch Set: gclient sync 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_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
2 #
3 # Use of this source code is governed by a BSD-style license
4 # that can be found in the LICENSE file in the root of the source
5 # tree. An additional intellectual property rights grant can be found
6 # in the file PATENTS. All contributing project authors may
7 # be found in the AUTHORS file in the root of the source tree.
8
9
10 class MockInputApi(object):
11 """Mock class for the InputApi class.
12
13 This class can be used for unittests for presubmit by initializing the files
14 attribute as the list of changed files.
15 """
16
17 def __init__(self):
18 self.change = MockChange([])
19
20
21 class MockOutputApi(object):
22 """Mock class for the OutputApi class.
23
24 An instance of this class can be passed to presubmit unittests for outputing
25 various types of results.
26 """
27
28 class PresubmitResult(object):
29 def __init__(self, message, items=None, long_text=''):
30 self.message = message
31 self.items = items
32 self.long_text = long_text
33
34 def __repr__(self):
35 return self.message
36
37 class PresubmitError(PresubmitResult):
38 def __init__(self, message, items=None, long_text=''):
39 MockOutputApi.PresubmitResult.__init__(self, message, items, long_text)
40 self.type = 'error'
41
42 class MockChange(object):
43 """Mock class for Change class.
44
45 This class can be used in presubmit unittests to mock the query of the
46 current change.
47 """
48
49 def __init__(self, changed_files):
50 self._changed_files = changed_files
OLDNEW
« no previous file with comments | « presubmit_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698