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 scm.py.""" | 6 """Unit tests for scm.py.""" |
7 | 7 |
8 # pylint: disable=E1101,W0403 | 8 # pylint: disable=E1101,W0403 |
9 from __future__ import with_statement | 9 from __future__ import with_statement |
10 import logging | 10 import logging |
(...skipping 27 matching lines...) Expand all Loading... |
38 self.mox.StubOutWithMock(subprocess2, 'Popen') | 38 self.mox.StubOutWithMock(subprocess2, 'Popen') |
39 self.mox.StubOutWithMock(subprocess2, 'communicate') | 39 self.mox.StubOutWithMock(subprocess2, 'communicate') |
40 | 40 |
41 | 41 |
42 class RootTestCase(BaseSCMTestCase): | 42 class RootTestCase(BaseSCMTestCase): |
43 def testMembersChanged(self): | 43 def testMembersChanged(self): |
44 self.mox.ReplayAll() | 44 self.mox.ReplayAll() |
45 members = [ | 45 members = [ |
46 'ElementTree', 'GetCasedPath', 'GenFakeDiff', 'GIT', 'SVN', | 46 'ElementTree', 'GetCasedPath', 'GenFakeDiff', 'GIT', 'SVN', |
47 'ValidateEmail', | 47 'ValidateEmail', |
48 'cStringIO', 'determine_scm', 'gclient_utils', 'glob', 'logging', | 48 'cStringIO', 'determine_scm', 'gclient_utils', 'glob', 'logging', 'os', |
49 'only_int', 'os', 're', 'subprocess2', 'sys', 'tempfile', 'time', | 49 're', 'subprocess2', 'sys', 'tempfile', 'time', |
50 ] | 50 ] |
51 # If this test fails, you should add the relevant test. | 51 # If this test fails, you should add the relevant test. |
52 self.compareMembers(scm, members) | 52 self.compareMembers(scm, members) |
53 | 53 |
54 | 54 |
55 class GitWrapperTestCase(BaseSCMTestCase): | 55 class GitWrapperTestCase(BaseSCMTestCase): |
56 def testMembersChanged(self): | 56 def testMembersChanged(self): |
57 members = [ | 57 members = [ |
58 'AssertVersion', 'Capture', 'CaptureStatus', | 58 'AssertVersion', 'Capture', 'CaptureStatus', |
59 'FetchUpstreamTuple', | 59 'FetchUpstreamTuple', |
60 'GenerateDiff', 'GetBranch', 'GetBranchRef', 'GetCheckoutRoot', | 60 'GenerateDiff', 'GetBranch', 'GetBranchRef', 'GetCheckoutRoot', |
61 'GetDifferentFiles', 'GetEmail', 'GetPatchName', 'GetSVNBranch', | 61 'GetDifferentFiles', 'GetEmail', 'GetPatchName', 'GetSVNBranch', |
62 'GetUpstreamBranch', 'IsGitSvn', 'MatchSvnGlob', 'ShortBranchName', | 62 'GetUpstreamBranch', 'IsGitSvn', 'MatchSvnGlob', 'ShortBranchName', |
63 'current_version', | |
64 ] | 63 ] |
65 # If this test fails, you should add the relevant test. | 64 # If this test fails, you should add the relevant test. |
66 self.compareMembers(scm.GIT, members) | 65 self.compareMembers(scm.GIT, members) |
67 | 66 |
68 def testGetEmail(self): | 67 def testGetEmail(self): |
69 self.mox.StubOutWithMock(scm.GIT, 'Capture') | 68 self.mox.StubOutWithMock(scm.GIT, 'Capture') |
70 scm.GIT.Capture(['config', 'user.email'], cwd=self.root_dir | 69 scm.GIT.Capture(['config', 'user.email'], cwd=self.root_dir |
71 ).AndReturn('mini@me.com') | 70 ).AndReturn('mini@me.com') |
72 self.mox.ReplayAll() | 71 self.mox.ReplayAll() |
73 self.assertEqual(scm.GIT.GetEmail(self.root_dir), 'mini@me.com') | 72 self.assertEqual(scm.GIT.GetEmail(self.root_dir), 'mini@me.com') |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 # Asserting the tree is not sufficient, svn status must come out clear too. | 335 # Asserting the tree is not sufficient, svn status must come out clear too. |
337 self.assertEquals('', self._capture(['status'])) | 336 self.assertEquals('', self._capture(['status'])) |
338 | 337 |
339 | 338 |
340 if __name__ == '__main__': | 339 if __name__ == '__main__': |
341 if '-v' in sys.argv: | 340 if '-v' in sys.argv: |
342 logging.basicConfig(level=logging.DEBUG) | 341 logging.basicConfig(level=logging.DEBUG) |
343 unittest.main() | 342 unittest.main() |
344 | 343 |
345 # vim: ts=2:sw=2:tw=80:et: | 344 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |