OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2010 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 from shutil import rmtree | 8 from shutil import rmtree |
9 import tempfile | 9 import tempfile |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 'FetchUpstreamTuple', | 53 'FetchUpstreamTuple', |
54 'GenerateDiff', 'GetBranch', 'GetBranchRef', 'GetCheckoutRoot', | 54 'GenerateDiff', 'GetBranch', 'GetBranchRef', 'GetCheckoutRoot', |
55 'GetDifferentFiles', 'GetEmail', 'GetPatchName', 'GetSVNBranch', | 55 'GetDifferentFiles', 'GetEmail', 'GetPatchName', 'GetSVNBranch', |
56 'GetUpstreamBranch', 'IsGitSvn', 'ShortBranchName', | 56 'GetUpstreamBranch', 'IsGitSvn', 'ShortBranchName', |
57 ] | 57 ] |
58 # If this test fails, you should add the relevant test. | 58 # If this test fails, you should add the relevant test. |
59 self.compareMembers(scm.GIT, members) | 59 self.compareMembers(scm.GIT, members) |
60 | 60 |
61 def testGetEmail(self): | 61 def testGetEmail(self): |
62 self.mox.StubOutWithMock(scm.GIT, 'Capture') | 62 self.mox.StubOutWithMock(scm.GIT, 'Capture') |
63 scm.GIT.Capture(['config', 'user.email'], self.root_dir, error_ok=True | 63 scm.GIT.Capture(['config', 'user.email'], cwd=self.root_dir |
64 ).AndReturn(['mini@me.com', '']) | 64 ).AndReturn('mini@me.com') |
65 self.mox.ReplayAll() | 65 self.mox.ReplayAll() |
66 self.assertEqual(scm.GIT.GetEmail(self.root_dir), 'mini@me.com') | 66 self.assertEqual(scm.GIT.GetEmail(self.root_dir), 'mini@me.com') |
67 | 67 |
68 | 68 |
69 class SVNTestCase(BaseSCMTestCase): | 69 class SVNTestCase(BaseSCMTestCase): |
70 def setUp(self): | 70 def setUp(self): |
71 BaseSCMTestCase.setUp(self) | 71 BaseSCMTestCase.setUp(self) |
72 self.mox.StubOutWithMock(scm.SVN, 'Capture') | 72 self.mox.StubOutWithMock(scm.SVN, 'Capture') |
73 self.url = self.SvnUrl() | 73 self.url = self.SvnUrl() |
74 | 74 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 self.mox.ReplayAll() | 232 self.mox.ReplayAll() |
233 info = scm.SVN.CaptureStatus(None) | 233 info = scm.SVN.CaptureStatus(None) |
234 self.assertEquals(info, []) | 234 self.assertEquals(info, []) |
235 | 235 |
236 | 236 |
237 if __name__ == '__main__': | 237 if __name__ == '__main__': |
238 import unittest | 238 import unittest |
239 unittest.main() | 239 unittest.main() |
240 | 240 |
241 # vim: ts=2:sw=2:tw=80:et: | 241 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |