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

Side by Side Diff: tests/mocks.py

Issue 23483019: Changes to support One-Click Revert in Commit Queue (Closed) Base URL: https://src.chromium.org/chrome/trunk/tools/commit-queue/
Patch Set: Created 7 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 | « tests/committer_revert_test.py ('k') | tests/pending_manager_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Common mocks.""" 5 """Common mocks."""
6 6
7 import copy 7 import copy
8 import os 8 import os
9 import sys 9 import sys
10 10
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 "commit": True, 79 "commit": True,
80 }, 80 },
81 } 81 }
82 self.patchsets = [] 82 self.patchsets = []
83 # Key is (issue, patchset) 83 # Key is (issue, patchset)
84 self.patchsets_properties = {} 84 self.patchsets_properties = {}
85 85
86 def get_pending_issues(self): 86 def get_pending_issues(self):
87 return self.issues.keys() 87 return self.issues.keys()
88 88
89 def get_revert_issues(self):
90 return self.issues.keys()
91
89 def get_issue_properties(self, issue_id, _): 92 def get_issue_properties(self, issue_id, _):
90 return copy.deepcopy(self.issues[issue_id]) 93 return copy.deepcopy(self.issues[issue_id])
91 94
92 def get_patchset_properties(self, issue_id, patchset): 95 def get_patchset_properties(self, issue_id, patchset):
93 key = (issue_id, patchset) 96 key = (issue_id, patchset)
94 self.unit_test.assertTrue( 97 self.unit_test.assertTrue(
95 key in self.patchsets_properties, (key, self.patchsets_properties)) 98 key in self.patchsets_properties, (key, self.patchsets_properties))
96 return copy.deepcopy(self.patchsets_properties[key]) 99 return copy.deepcopy(self.patchsets_properties[key])
97 100
98 def close_issue(self, *args, **kwargs): 101 def close_issue(self, *args, **kwargs):
99 self._register_call(*args, **kwargs) 102 self._register_call(*args, **kwargs)
100 103
104 def open_issue(self, *args, **kwargs):
105 self._register_call(*args, **kwargs)
106
101 def update_description(self, *args, **kwargs): 107 def update_description(self, *args, **kwargs):
102 self._register_call(*args, **kwargs) 108 self._register_call(*args, **kwargs)
103 109
104 def set_flag(self, *args, **kwargs): 110 def set_flag(self, *args, **kwargs):
105 self._register_call(*args, **kwargs) 111 self._register_call(*args, **kwargs)
106 return True 112 return True
107 113
108 def add_comment(self, *args, **kwargs): 114 def add_comment(self, *args, **kwargs):
109 self._register_call(*args, **kwargs) 115 self._register_call(*args, **kwargs)
110 116
(...skipping 24 matching lines...) Expand all
135 super(SvnCheckoutMock, self).__init__(*args) 141 super(SvnCheckoutMock, self).__init__(*args)
136 self.project_path = os.getcwd() 142 self.project_path = os.getcwd()
137 self.project_name = os.path.basename(self.project_path) 143 self.project_name = os.path.basename(self.project_path)
138 self.post_processors = [] 144 self.post_processors = []
139 145
140 def prepare(self, revision): 146 def prepare(self, revision):
141 self._register_call(revision) 147 self._register_call(revision)
142 # prepare() should always return a valid revision. 148 # prepare() should always return a valid revision.
143 return revision or 124 149 return revision or 124
144 150
145 def apply_patch(self, *args): 151 def apply_patch(self, *args, **kwargs):
146 self._register_call(*args) 152 self._register_call(*args, **kwargs)
147 153
148 def commit(self, *args): 154 def commit(self, *args):
149 self._register_call(*args) 155 self._register_call(*args)
150 return 125 156 return 125
151 157
152 @staticmethod 158 @staticmethod
153 def get_settings(_key): 159 def get_settings(_key):
154 return None 160 return None
155 161
156 @staticmethod 162 @staticmethod
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 finally: 273 finally:
268 super(TestCase, self).tearDown() 274 super(TestCase, self).tearDown()
269 275
270 def _send_stack_mock(self, last_tb, stack, *_args, **_kwargs): 276 def _send_stack_mock(self, last_tb, stack, *_args, **_kwargs):
271 """Fails a test that calls SendStack. 277 """Fails a test that calls SendStack.
272 278
273 In practice it doesn't happen when a test pass but will when a test fails so 279 In practice it doesn't happen when a test pass but will when a test fails so
274 hook it here so breakpad doesn't send too many stack traces to maintainers. 280 hook it here so breakpad doesn't send too many stack traces to maintainers.
275 """ 281 """
276 self.fail('%s, %s' % (last_tb, stack)) 282 self.fail('%s, %s' % (last_tb, stack))
OLDNEW
« no previous file with comments | « tests/committer_revert_test.py ('k') | tests/pending_manager_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698