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 trychange.py.""" | 6 """Unit tests for trychange.py.""" |
7 | 7 |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 | 10 |
11 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | 11 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
12 | 12 |
13 from super_mox import SuperMoxTestBase | 13 from testing_support.super_mox import SuperMoxTestBase |
14 | 14 |
15 import subprocess2 | 15 import subprocess2 |
16 import trychange | 16 import trychange |
17 | 17 |
18 | 18 |
19 class TryChangeTestsBase(SuperMoxTestBase): | 19 class TryChangeTestsBase(SuperMoxTestBase): |
20 """Setups and tear downs the mocks but doesn't test anything as-is.""" | 20 """Setups and tear downs the mocks but doesn't test anything as-is.""" |
21 def setUp(self): | 21 def setUp(self): |
22 SuperMoxTestBase.setUp(self) | 22 SuperMoxTestBase.setUp(self) |
23 self.mox.StubOutWithMock(subprocess2, 'communicate') | 23 self.mox.StubOutWithMock(subprocess2, 'communicate') |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 self.mox.ReplayAll() | 106 self.mox.ReplayAll() |
107 git = trychange.GIT(self.options, self.fake_root, self.options.files) | 107 git = trychange.GIT(self.options, self.fake_root, self.options.files) |
108 self.assertEqual(git.GetFileNames(), self.expected_files) | 108 self.assertEqual(git.GetFileNames(), self.expected_files) |
109 self.assertEqual(git.checkout_root, self.fake_root) | 109 self.assertEqual(git.checkout_root, self.fake_root) |
110 self.assertEqual(git.GenerateDiff(), 'A diff') | 110 self.assertEqual(git.GenerateDiff(), 'A diff') |
111 | 111 |
112 | 112 |
113 if __name__ == '__main__': | 113 if __name__ == '__main__': |
114 import unittest | 114 import unittest |
115 unittest.main() | 115 unittest.main() |
OLD | NEW |