| 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 pending_manager.py.""" | 6 """Unit tests for pending_manager.py.""" |
| 7 | 7 |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 issue)) | 55 issue)) |
| 56 | 56 |
| 57 | 57 |
| 58 class TestPendingManager(mocks.TestCase): | 58 class TestPendingManager(mocks.TestCase): |
| 59 def setUp(self): | 59 def setUp(self): |
| 60 super(TestPendingManager, self).setUp() | 60 super(TestPendingManager, self).setUp() |
| 61 self.root_dir = ROOT_DIR | 61 self.root_dir = ROOT_DIR |
| 62 | 62 |
| 63 def testLoadSave(self): | 63 def testLoadSave(self): |
| 64 pc = pending_manager.PendingManager( | 64 pc = pending_manager.PendingManager( |
| 65 context.Context(None, None, mocks.AsyncPushMock(self)), | 65 context.Context(None, None, mocks.AsyncPushMock(self), |
| 66 'commit-bot@chromium.org'), |
| 66 [fake.FakeVerifier(base.SUCCEEDED)], | 67 [fake.FakeVerifier(base.SUCCEEDED)], |
| 67 []) | 68 []) |
| 68 filename = os.path.join(self.root_dir, 'foo.json') | 69 filename = os.path.join(self.root_dir, 'foo.json') |
| 69 empty = """{ | 70 empty = """{ |
| 70 "__persistent_type__": "PendingQueue", | 71 "__persistent_type__": "PendingQueue", |
| 71 "pending_commits": {} | 72 "pending_commits": {} |
| 72 } | 73 } |
| 73 """ | 74 """ |
| 74 write(filename, empty) | 75 write(filename, empty) |
| 75 try: | 76 try: |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 self.context.checkout.check_calls( | 726 self.context.checkout.check_calls( |
| 726 self._prepare_apply_commit(0, issue)) | 727 self._prepare_apply_commit(0, issue)) |
| 727 | 728 |
| 728 | 729 |
| 729 if __name__ == '__main__': | 730 if __name__ == '__main__': |
| 730 logging.basicConfig( | 731 logging.basicConfig( |
| 731 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ | 732 level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][ |
| 732 min(sys.argv.count('-v'), 3)], | 733 min(sys.argv.count('-v'), 3)], |
| 733 format='%(levelname)5s %(module)15s(%(lineno)3d): %(message)s') | 734 format='%(levelname)5s %(module)15s(%(lineno)3d): %(message)s') |
| 734 unittest.main() | 735 unittest.main() |
| OLD | NEW |