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

Side by Side Diff: tests/rietveld_test.py

Issue 10272024: There is no reason to not assume that status:null isn't 'M'. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 7 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 | « rietveld.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) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 self.assertEquals(p.is_git_diff, is_git_diff) 81 self.assertEquals(p.is_git_diff, is_git_diff)
82 self.assertEquals(p.is_new, is_new) 82 self.assertEquals(p.is_new, is_new)
83 if hasattr(p, 'patchlevel'): 83 if hasattr(p, 'patchlevel'):
84 self.assertEquals(p.patchlevel, patchlevel) 84 self.assertEquals(p.patchlevel, patchlevel)
85 if diff: 85 if diff:
86 self.assertEquals(p.get(True), diff) 86 self.assertEquals(p.get(True), diff)
87 if hasattr(p, 'svn_properties'): 87 if hasattr(p, 'svn_properties'):
88 self.assertEquals(p.svn_properties, svn_properties) 88 self.assertEquals(p.svn_properties, svn_properties)
89 89
90 def test_get_patch_no_status(self): 90 def test_get_patch_no_status(self):
91 self.requests = [('/api/123/456', _api({'file_a': {}}))] 91 self.requests = [
92 try: 92 ( '/api/123/456',
93 self.rietveld.get_patch(123, 456) 93 _api(
94 self.fail() 94 {
95 except patch.UnsupportedPatchFormat, e: 95 'tools/clang_check/README.chromium': {
96 self.assertEquals('file_a', e.filename) 96 'status': None,
97 'id': 789,
98 }})),
99 ('/download/issue123_456_789.diff', RAW.DELETE),
100 ]
101 patches = self.rietveld.get_patch(123, 456)
102 self.assertEquals(1, len(patches.patches))
103 self._check_patch(
104 patches.patches[0],
105 'tools/clang_check/README.chromium',
106 RAW.DELETE,
107 is_delete=True)
97 108
98 def test_get_patch_2_files(self): 109 def test_get_patch_2_files(self):
99 self.requests = [ 110 self.requests = [
100 ('/api/123/456', 111 ('/api/123/456',
101 _api({'foo': _file('A'), 'file_a': _file('M', chunk_id=790)})), 112 _api({'foo': _file('A'), 'file_a': _file('M', chunk_id=790)})),
102 ('/download/issue123_456_789.diff', RAW.NEW), 113 ('/download/issue123_456_789.diff', RAW.NEW),
103 ('/download/issue123_456_790.diff', RAW.NEW_NOT_NULL), 114 ('/download/issue123_456_790.diff', RAW.NEW_NOT_NULL),
104 ] 115 ]
105 patches = self.rietveld.get_patch(123, 456) 116 patches = self.rietveld.get_patch(123, 456)
106 self.assertEquals(2, len(patches.patches)) 117 self.assertEquals(2, len(patches.patches))
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 ] 380 ]
370 for i in self.rietveld.search(base='base'): 381 for i in self.rietveld.search(base='base'):
371 self.assertEquals(expected.pop(0), i) 382 self.assertEquals(expected.pop(0), i)
372 self.assertEquals([], expected) 383 self.assertEquals([], expected)
373 384
374 385
375 if __name__ == '__main__': 386 if __name__ == '__main__':
376 logging.basicConfig(level=[ 387 logging.basicConfig(level=[
377 logging.ERROR, logging.INFO, logging.DEBUG][min(2, sys.argv.count('-v'))]) 388 logging.ERROR, logging.INFO, logging.DEBUG][min(2, sys.argv.count('-v'))])
378 unittest.main() 389 unittest.main()
OLDNEW
« no previous file with comments | « rietveld.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698