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 gcl.py.""" | 6 """Unit tests for gcl.py.""" |
7 | 7 |
8 # pylint: disable=E1103,E1101,E1120 | 8 # pylint: disable=E1103,E1101,E1120 |
9 | 9 |
10 import os | 10 import os |
11 import sys | 11 import sys |
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.super_mox import mox, SuperMoxTestBase | 15 from testing_support.super_mox import mox, SuperMoxTestBase |
16 | 16 |
17 import gcl | 17 import gcl |
18 import presubmit_support | 18 import presubmit_support |
19 | 19 |
20 | 20 |
21 class GclTestsBase(SuperMoxTestBase): | 21 class GclTestsBase(SuperMoxTestBase): |
22 """Setups and tear downs the mocks but doesn't test anything as-is.""" | 22 """Setups and tear downs the mocks but doesn't test anything as-is.""" |
23 def setUp(self): | 23 def setUp(self): |
24 SuperMoxTestBase.setUp(self) | 24 SuperMoxTestBase.setUp(self) |
25 self.fake_root_dir = self.RootDir() | 25 self.fake_root_dir = self.RootDir() |
26 self.mox.StubOutWithMock(gcl, 'RunShell') | 26 self.mox.StubOutWithMock(gcl, 'RunShell') |
27 self.mox.StubOutWithMock(gcl.SVN, 'CaptureInfo') | 27 self.mox.StubOutWithMock(gcl.SVN, '_CaptureInfo') |
28 self.mox.StubOutWithMock(gcl.SVN, 'GetCheckoutRoot') | 28 self.mox.StubOutWithMock(gcl.SVN, 'GetCheckoutRoot') |
29 self.mox.StubOutWithMock(gcl, 'tempfile') | 29 self.mox.StubOutWithMock(gcl, 'tempfile') |
30 self.mox.StubOutWithMock(gcl.upload, 'RealMain') | 30 self.mox.StubOutWithMock(gcl.upload, 'RealMain') |
31 self.mox.StubOutWithMock(gcl.gclient_utils, 'FileRead') | 31 self.mox.StubOutWithMock(gcl.gclient_utils, 'FileRead') |
32 self.mox.StubOutWithMock(gcl.gclient_utils, 'FileWrite') | 32 self.mox.StubOutWithMock(gcl.gclient_utils, 'FileWrite') |
33 gcl.REPOSITORY_ROOT = None | 33 gcl.REPOSITORY_ROOT = None |
34 self.old_review_settings = gcl.CODEREVIEW_SETTINGS | 34 self.old_review_settings = gcl.CODEREVIEW_SETTINGS |
35 self.assertEquals(gcl.CODEREVIEW_SETTINGS, {}) | 35 self.assertEquals(gcl.CODEREVIEW_SETTINGS, {}) |
36 | 36 |
37 def tearDown(self): | 37 def tearDown(self): |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 self.assertEquals(change_info.description, | 587 self.assertEquals(change_info.description, |
588 'deescription\n\nCommitted: http://view/12345') | 588 'deescription\n\nCommitted: http://view/12345') |
589 # pylint: disable=W0212 | 589 # pylint: disable=W0212 |
590 self.assertTrue(change_info._deleted) | 590 self.assertTrue(change_info._deleted) |
591 self.assertTrue(change_info._closed) | 591 self.assertTrue(change_info._closed) |
592 | 592 |
593 | 593 |
594 if __name__ == '__main__': | 594 if __name__ == '__main__': |
595 import unittest | 595 import unittest |
596 unittest.main() | 596 unittest.main() |
OLD | NEW |