OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 scm.py.""" | 6 """Unit tests for scm.py.""" |
7 | 7 |
8 import shutil | 8 from shutil import rmtree |
9 import tempfile | 9 import tempfile |
10 | 10 |
| 11 # Fixes include path. |
| 12 from super_mox import mox, SuperMoxBaseTestBase |
| 13 |
11 from gclient_test import BaseTestCase | 14 from gclient_test import BaseTestCase |
12 import scm | 15 import scm |
13 from super_mox import mox, SuperMoxBaseTestBase | |
14 | 16 |
15 | 17 |
16 class BaseSCMTestCase(BaseTestCase): | 18 class BaseSCMTestCase(BaseTestCase): |
17 def setUp(self): | 19 def setUp(self): |
18 BaseTestCase.setUp(self) | 20 BaseTestCase.setUp(self) |
19 self.mox.StubOutWithMock(scm.gclient_utils, 'SubprocessCall') | 21 self.mox.StubOutWithMock(scm.gclient_utils, 'SubprocessCall') |
20 self.mox.StubOutWithMock(scm.gclient_utils, 'SubprocessCallAndFilter') | 22 self.mox.StubOutWithMock(scm.gclient_utils, 'SubprocessCallAndFilter') |
21 | 23 |
22 | 24 |
23 class RootTestCase(BaseSCMTestCase): | 25 class RootTestCase(BaseSCMTestCase): |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 SuperMoxBaseTestBase.setUp(self) | 105 SuperMoxBaseTestBase.setUp(self) |
104 self.args = self.Args() | 106 self.args = self.Args() |
105 self.url = 'git://foo' | 107 self.url = 'git://foo' |
106 self.root_dir = tempfile.mkdtemp() | 108 self.root_dir = tempfile.mkdtemp() |
107 self.relpath = '.' | 109 self.relpath = '.' |
108 self.base_path = scm.os.path.join(self.root_dir, self.relpath) | 110 self.base_path = scm.os.path.join(self.root_dir, self.relpath) |
109 self.enabled = self.CreateGitRepo(self.sample_git_import, self.base_path) | 111 self.enabled = self.CreateGitRepo(self.sample_git_import, self.base_path) |
110 self.fake_root = self.Dir() | 112 self.fake_root = self.Dir() |
111 | 113 |
112 def tearDown(self): | 114 def tearDown(self): |
113 shutil.rmtree(self.root_dir) | 115 rmtree(self.root_dir) |
114 SuperMoxBaseTestBase.tearDown(self) | 116 SuperMoxBaseTestBase.tearDown(self) |
115 | 117 |
116 def testMembersChanged(self): | 118 def testMembersChanged(self): |
117 self.mox.ReplayAll() | 119 self.mox.ReplayAll() |
118 members = [ | 120 members = [ |
119 'COMMAND', 'Capture', 'CaptureStatus', 'FetchUpstreamTuple', | 121 'COMMAND', 'Capture', 'CaptureStatus', 'FetchUpstreamTuple', |
120 'GenerateDiff', 'GetBranch', 'GetBranchRef', 'GetCheckoutRoot', | 122 'GenerateDiff', 'GetBranch', 'GetBranchRef', 'GetCheckoutRoot', |
121 'GetDifferentFiles', 'GetEmail', 'GetPatchName', 'GetSVNBranch', | 123 'GetDifferentFiles', 'GetEmail', 'GetPatchName', 'GetSVNBranch', |
122 'GetUpstream', 'IsGitSvn', 'RunAndFilterOutput', 'ShortBranchName', | 124 'GetUpstream', 'IsGitSvn', 'RunAndFilterOutput', 'ShortBranchName', |
123 ] | 125 ] |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 self.mox.ReplayAll() | 323 self.mox.ReplayAll() |
322 info = scm.SVN.CaptureStatus(None) | 324 info = scm.SVN.CaptureStatus(None) |
323 self.assertEquals(info, []) | 325 self.assertEquals(info, []) |
324 | 326 |
325 | 327 |
326 if __name__ == '__main__': | 328 if __name__ == '__main__': |
327 import unittest | 329 import unittest |
328 unittest.main() | 330 unittest.main() |
329 | 331 |
330 # vim: ts=2:sw=2:tw=80:et: | 332 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |