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 ssl | 10 import ssl |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 def test_search_all_empty(self): | 332 def test_search_all_empty(self): |
333 url = ( | 333 url = ( |
334 '/search?format=json' | 334 '/search?format=json' |
335 '&base=base' | 335 '&base=base' |
336 '&created_after=2010-01-02' | 336 '&created_after=2010-01-02' |
337 '&created_before=2010-01-01' | 337 '&created_before=2010-01-01' |
338 '&modified_after=2010-02-02' | 338 '&modified_after=2010-02-02' |
339 '&modified_before=2010-02-01' | 339 '&modified_before=2010-02-01' |
340 '&owner=owner%40example.com' | 340 '&owner=owner%40example.com' |
341 '&reviewer=reviewer%40example.com' | 341 '&reviewer=reviewer%40example.com' |
342 '&closed=2' | 342 '&closed=True' |
343 '&commit=2' | 343 '&commit=True' |
344 '&private=2' | 344 '&private=True' |
345 '&keys_only=True' | 345 '&keys_only=True' |
346 '&with_messages=True' | 346 '&with_messages=True' |
347 '&limit=23') | 347 '&limit=23') |
348 self.requests = [ | 348 self.requests = [ |
349 (url, '{}'), | 349 (url, '{}'), |
350 ] | 350 ] |
351 results = list(self.rietveld.search( | 351 results = list(self.rietveld.search( |
352 'owner@example.com', | 352 'owner@example.com', |
353 'reviewer@example.com', | 353 'reviewer@example.com', |
354 'base', | 354 'base', |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 self.mock(time, 'sleep', self.MockSleep) | 482 self.mock(time, 'sleep', self.MockSleep) |
483 self.sleep_time = 0 | 483 self.sleep_time = 0 |
484 with self.assertRaises(ssl.SSLError): | 484 with self.assertRaises(ssl.SSLError): |
485 self.rietveld.post('/api/1234', [('key', 'data')]) | 485 self.rietveld.post('/api/1234', [('key', 'data')]) |
486 self.assertNotEqual(self.sleep_time, 0) | 486 self.assertNotEqual(self.sleep_time, 0) |
487 | 487 |
488 if __name__ == '__main__': | 488 if __name__ == '__main__': |
489 logging.basicConfig(level=[ | 489 logging.basicConfig(level=[ |
490 logging.ERROR, logging.INFO, logging.DEBUG][min(2, sys.argv.count('-v'))]) | 490 logging.ERROR, logging.INFO, logging.DEBUG][min(2, sys.argv.count('-v'))]) |
491 unittest.main() | 491 unittest.main() |
OLD | NEW |