| OLD | NEW |
| 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 |
| 11 import unittest | 11 import unittest |
| 12 | 12 |
| 13 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | 13 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| 14 | 14 |
| 15 from testing_support.patches_data import GIT, RAW |
| 16 |
| 15 import patch | 17 import patch |
| 16 import rietveld | 18 import rietveld |
| 17 from tests.patches_data import GIT, RAW | |
| 18 | 19 |
| 19 | 20 |
| 20 def _api(files): | 21 def _api(files): |
| 21 """Mock a rietveld api request.""" | 22 """Mock a rietveld api request.""" |
| 22 return rietveld.json.dumps({'files': files}) | 23 return rietveld.json.dumps({'files': files}) |
| 23 | 24 |
| 24 | 25 |
| 25 def _file( | 26 def _file( |
| 26 status, is_binary=False, num_chunks=1, chunk_id=789, property_changes=''): | 27 status, is_binary=False, num_chunks=1, chunk_id=789, property_changes=''): |
| 27 """Mock a file in a rietveld api request.""" | 28 """Mock a file in a rietveld api request.""" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 {'foo': 'prout'}, | 343 {'foo': 'prout'}, |
| 343 ] | 344 ] |
| 344 for i in self.rietveld.search(base='base'): | 345 for i in self.rietveld.search(base='base'): |
| 345 self.assertEquals(expected.pop(0), i) | 346 self.assertEquals(expected.pop(0), i) |
| 346 self.assertEquals([], expected) | 347 self.assertEquals([], expected) |
| 347 | 348 |
| 348 | 349 |
| 349 if __name__ == '__main__': | 350 if __name__ == '__main__': |
| 350 logging.basicConfig(level=logging.ERROR) | 351 logging.basicConfig(level=logging.ERROR) |
| 351 unittest.main() | 352 unittest.main() |
| OLD | NEW |