| OLD | NEW |
| 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 self.assertEquals( | 282 self.assertEquals( |
| 283 [('svn:executable', '*'), ('svn:eol-style', 'LF')], | 283 [('svn:executable', '*'), ('svn:eol-style', 'LF')], |
| 284 rietveld.Rietveld.parse_svn_properties( | 284 rietveld.Rietveld.parse_svn_properties( |
| 285 '\n' | 285 '\n' |
| 286 'Added: svn:executable\n' | 286 'Added: svn:executable\n' |
| 287 ' + *\n' | 287 ' + *\n' |
| 288 'Added: svn:eol-style\n' | 288 'Added: svn:eol-style\n' |
| 289 ' + LF\n', | 289 ' + LF\n', |
| 290 'foo')) | 290 'foo')) |
| 291 | 291 |
| 292 # http://codereview.chromium.org/api/9139006/7001 |
| 293 self.assertEquals( |
| 294 [('svn:mime-type', 'image/png')], |
| 295 rietveld.Rietveld.parse_svn_properties( |
| 296 '\n' |
| 297 'Added: svn:mime-type\n' |
| 298 ' + image/png\n', |
| 299 'foo')) |
| 300 |
| 292 def test_bad_svn_properties(self): | 301 def test_bad_svn_properties(self): |
| 293 try: | 302 try: |
| 294 rietveld.Rietveld.parse_svn_properties(u'\n', 'foo') | 303 rietveld.Rietveld.parse_svn_properties(u'\n', 'foo') |
| 295 self.fail() | 304 self.fail() |
| 296 except rietveld.patch.UnsupportedPatchFormat, e: | 305 except rietveld.patch.UnsupportedPatchFormat, e: |
| 297 self.assertEquals('foo', e.filename) | 306 self.assertEquals('foo', e.filename) |
| 298 # TODO(maruel): Change with no diff, only svn property change: | 307 # TODO(maruel): Change with no diff, only svn property change: |
| 299 # http://codereview.chromium.org/6462019/ | 308 # http://codereview.chromium.org/6462019/ |
| 300 | 309 |
| 301 def test_search_all_empty(self): | 310 def test_search_all_empty(self): |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 ] | 369 ] |
| 361 for i in self.rietveld.search(base='base'): | 370 for i in self.rietveld.search(base='base'): |
| 362 self.assertEquals(expected.pop(0), i) | 371 self.assertEquals(expected.pop(0), i) |
| 363 self.assertEquals([], expected) | 372 self.assertEquals([], expected) |
| 364 | 373 |
| 365 | 374 |
| 366 if __name__ == '__main__': | 375 if __name__ == '__main__': |
| 367 logging.basicConfig(level=[ | 376 logging.basicConfig(level=[ |
| 368 logging.ERROR, logging.INFO, logging.DEBUG][min(2, sys.argv.count('-v'))]) | 377 logging.ERROR, logging.INFO, logging.DEBUG][min(2, sys.argv.count('-v'))]) |
| 369 unittest.main() | 378 unittest.main() |
| OLD | NEW |