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

Side by Side Diff: tests/rietveld_test.py

Issue 9167015: Fix svn delete handling (again). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « tests/patch_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
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 def test_get_patch_2_files(self): 98 def test_get_patch_2_files(self):
99 self.requests = [ 99 self.requests = [
100 ('/api/123/456', 100 ('/api/123/456',
101 _api({'foo': _file('A'), 'file_a': _file('M', chunk_id=790)})), 101 _api({'foo': _file('A'), 'file_a': _file('M', chunk_id=790)})),
102 ('/download/issue123_456_789.diff', RAW.NEW), 102 ('/download/issue123_456_789.diff', RAW.NEW),
103 ('/download/issue123_456_790.diff', RAW.NEW_NOT_NULL), 103 ('/download/issue123_456_790.diff', RAW.NEW_NOT_NULL),
104 ] 104 ]
105 patches = self.rietveld.get_patch(123, 456) 105 patches = self.rietveld.get_patch(123, 456)
106 self.assertEquals(2, len(patches.patches)) 106 self.assertEquals(2, len(patches.patches))
107 # TODO(maruel): svn sucks. 107 self._check_patch(
108 self._check_patch(patches.patches[0], 'file_a', RAW.NEW_NOT_NULL) 108 patches.patches[0], 'file_a', RAW.NEW_NOT_NULL, is_new=True)
109 self._check_patch(patches.patches[1], 'foo', RAW.NEW, is_new=True) 109 self._check_patch(patches.patches[1], 'foo', RAW.NEW, is_new=True)
110 110
111 def test_get_patch_add(self): 111 def test_get_patch_add(self):
112 self.requests = [ 112 self.requests = [
113 ('/api/123/456', _api({'foo': _file('A')})), 113 ('/api/123/456', _api({'foo': _file('A')})),
114 ('/download/issue123_456_789.diff', RAW.NEW), 114 ('/download/issue123_456_789.diff', RAW.NEW),
115 ] 115 ]
116 patches = self.rietveld.get_patch(123, 456) 116 patches = self.rietveld.get_patch(123, 456)
117 self.assertEquals(1, len(patches.patches)) 117 self.assertEquals(1, len(patches.patches))
118 self._check_patch(patches.patches[0], 'foo', RAW.NEW, is_new=True) 118 self._check_patch(patches.patches[0], 'foo', RAW.NEW, is_new=True)
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 ] 360 ]
361 for i in self.rietveld.search(base='base'): 361 for i in self.rietveld.search(base='base'):
362 self.assertEquals(expected.pop(0), i) 362 self.assertEquals(expected.pop(0), i)
363 self.assertEquals([], expected) 363 self.assertEquals([], expected)
364 364
365 365
366 if __name__ == '__main__': 366 if __name__ == '__main__':
367 logging.basicConfig(level=[ 367 logging.basicConfig(level=[
368 logging.ERROR, logging.INFO, logging.DEBUG][min(2, sys.argv.count('-v'))]) 368 logging.ERROR, logging.INFO, logging.DEBUG][min(2, sys.argv.count('-v'))])
369 unittest.main() 369 unittest.main()
OLDNEW
« no previous file with comments | « tests/patch_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698