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

Side by Side Diff: tests/rietveld_test.py

Issue 8539016: Fix deleted empty files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « testing_support/patches_data.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
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Unit tests for rietveld.py.""" 6 """Unit tests for rietveld.py."""
7 7
8 import logging 8 import logging
9 import os 9 import os
10 import sys 10 import sys
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 is_new=True) 181 is_new=True)
182 182
183 def test_delete(self): 183 def test_delete(self):
184 name = 'tools/clang_check/README.chromium' 184 name = 'tools/clang_check/README.chromium'
185 self.requests = [ 185 self.requests = [
186 ('/api/123/456', _api({name: _file('D')})), 186 ('/api/123/456', _api({name: _file('D')})),
187 ('/download/issue123_456_789.diff', RAW.DELETE), 187 ('/download/issue123_456_789.diff', RAW.DELETE),
188 ] 188 ]
189 patches = self.rietveld.get_patch(123, 456) 189 patches = self.rietveld.get_patch(123, 456)
190 self.assertEquals(1, len(patches.patches)) 190 self.assertEquals(1, len(patches.patches))
191 self._check_patch(patches.patches[0], name, None, is_delete=True) 191 self._check_patch(patches.patches[0], name, RAW.DELETE, is_delete=True)
192
193 def test_delete_empty(self):
194 name = 'tests/__init__.py'
195 self.requests = [
196 ('/api/123/456', _api({name: _file('D')})),
197 ('/download/issue123_456_789.diff', GIT.DELETE_EMPTY),
198 ]
199 patches = self.rietveld.get_patch(123, 456)
200 self.assertEquals(1, len(patches.patches))
201 self._check_patch(
202 patches.patches[0],
203 name,
204 GIT.DELETE_EMPTY,
205 is_delete=True,
206 is_git_diff=True,
207 patchlevel=1)
192 208
193 def test_m_plus(self): 209 def test_m_plus(self):
194 properties = '\nAdded: svn:eol-style\n + LF\n' 210 properties = '\nAdded: svn:eol-style\n + LF\n'
195 self.requests = [ 211 self.requests = [
196 ('/api/123/456', 212 ('/api/123/456',
197 _api({'chrome/file.cc': _file('M+', property_changes=properties)})), 213 _api({'chrome/file.cc': _file('M+', property_changes=properties)})),
198 ('/download/issue123_456_789.diff', RAW.PATCH), 214 ('/download/issue123_456_789.diff', RAW.PATCH),
199 ] 215 ]
200 patches = self.rietveld.get_patch(123, 456) 216 patches = self.rietveld.get_patch(123, 456)
201 self.assertEquals(1, len(patches.patches)) 217 self.assertEquals(1, len(patches.patches))
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 {'foo': 'bar'}, 357 {'foo': 'bar'},
342 {'foo': 'baz'}, 358 {'foo': 'baz'},
343 {'foo': 'prout'}, 359 {'foo': 'prout'},
344 ] 360 ]
345 for i in self.rietveld.search(base='base'): 361 for i in self.rietveld.search(base='base'):
346 self.assertEquals(expected.pop(0), i) 362 self.assertEquals(expected.pop(0), i)
347 self.assertEquals([], expected) 363 self.assertEquals([], expected)
348 364
349 365
350 if __name__ == '__main__': 366 if __name__ == '__main__':
351 logging.basicConfig(level=logging.ERROR) 367 logging.basicConfig(level=[
368 logging.ERROR, logging.INFO, logging.DEBUG][min(2, sys.argv.count('-v'))])
352 unittest.main() 369 unittest.main()
OLDNEW
« no previous file with comments | « testing_support/patches_data.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698