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

Side by Side Diff: tests/rietveld_test.py

Issue 7776015: Implement reverse mangling of svn properties. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Clarify text, use more named variables Created 9 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 | 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) 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 self.assertEquals(1, len(patches.patches)) 66 self.assertEquals(1, len(patches.patches))
67 obj = patches.patches[0] 67 obj = patches.patches[0]
68 self.assertEquals(patch.FilePatchDiff, obj.__class__) 68 self.assertEquals(patch.FilePatchDiff, obj.__class__)
69 self.assertEquals('file_a', obj.filename) 69 self.assertEquals('file_a', obj.filename)
70 self.assertEquals([], obj.svn_properties) 70 self.assertEquals([], obj.svn_properties)
71 self.assertEquals(False, obj.is_git_diff) 71 self.assertEquals(False, obj.is_git_diff)
72 self.assertEquals(0, obj.patchlevel) 72 self.assertEquals(0, obj.patchlevel)
73 # This is because Rietveld._send() always returns the same buffer. 73 # This is because Rietveld._send() always returns the same buffer.
74 self.assertEquals(output, obj.get()) 74 self.assertEquals(output, obj.get())
75 75
76 def testSvnProperties(self):
77 # Line too long (N/80)
78 # pylint: disable=C0301
79
80 # To test one of these, run something like
81 # import json, pprint, urllib
82 # url = 'http://codereview.chromium.org/api/202046/1'
83 # pprint.pprint(json.load(urllib.urlopen(url))['files'])
84
85 # svn:mergeinfo across branches:
86 # http://codereview.chromium.org/202046/diff/1/third_party/libxml/xmlcatalog _dummy.cc
87 self.assertEquals(
88 [('svn:eol-style', 'LF')],
89 rietveld.Rietveld.parse_svn_properties(
90 u'\nAdded: svn:eol-style\n + LF\n', 'foo'))
91
92 # svn:eol-style property that is lost in the diff
93 # http://codereview.chromium.org/202046/diff/1/third_party/libxml/xmllint_du mmy.cc
94 self.assertEquals(
95 [],
96 rietveld.Rietveld.parse_svn_properties(
97 u'\nAdded: svn:mergeinfo\n'
98 ' Merged /branches/chrome_webkit_merge_branch/third_party/'
99 'libxml/xmldummy_mac.cc:r69-2775\n',
100 'foo'))
101
102 self.assertEquals(
103 [],
104 rietveld.Rietveld.parse_svn_properties(u'', 'foo'))
105
106 try:
107 rietveld.Rietveld.parse_svn_properties(u'\n', 'foo')
108 self.fail()
109 except rietveld.patch.UnsupportedPatchFormat, e:
110 self.assertEquals('foo', e.filename)
111 # TODO(maruel): Change with no diff, only svn property change:
112 # http://codereview.chromium.org/6462019/
76 113
77 114
78 if __name__ == '__main__': 115 if __name__ == '__main__':
79 logging.basicConfig(level=logging.ERROR) 116 logging.basicConfig(level=logging.ERROR)
80 unittest.main() 117 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