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 # pylint: disable=E1101,W0403 | 8 # pylint: disable=E1101,W0403 |
9 | 9 |
10 # Fixes include path. | 10 # Fixes include path. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 self.compareMembers(scm, members) | 46 self.compareMembers(scm, members) |
47 | 47 |
48 | 48 |
49 class GitWrapperTestCase(BaseSCMTestCase): | 49 class GitWrapperTestCase(BaseSCMTestCase): |
50 def testMembersChanged(self): | 50 def testMembersChanged(self): |
51 members = [ | 51 members = [ |
52 'AssertVersion', 'Capture', 'CaptureStatus', | 52 'AssertVersion', 'Capture', 'CaptureStatus', |
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', 'MatchSvnGlob', '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'], cwd=self.root_dir | 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 def testMatchSvnGlob(self): |
| 69 self.assertEquals(scm.GIT.MatchSvnGlob( |
| 70 'svn://svn.chromium.org/chrome/trunk/src', |
| 71 'svn://svn.chromium.org/chrome', |
| 72 'trunk/src:refs/remotes/origin/trunk', |
| 73 False), 'refs/remotes/origin/trunk') |
| 74 self.assertEquals(scm.GIT.MatchSvnGlob( |
| 75 'https://v8.googlecode.com/svn/branches/bleeding_edge', |
| 76 'https://v8.googlecode.com/svn', |
| 77 'branches/*:refs/remotes/*', |
| 78 True), 'refs/remotes/bleeding_edge') |
68 | 79 |
69 class SVNTestCase(BaseSCMTestCase): | 80 class SVNTestCase(BaseSCMTestCase): |
70 def setUp(self): | 81 def setUp(self): |
71 BaseSCMTestCase.setUp(self) | 82 BaseSCMTestCase.setUp(self) |
72 self.mox.StubOutWithMock(scm.SVN, 'Capture') | 83 self.mox.StubOutWithMock(scm.SVN, 'Capture') |
73 self.url = self.SvnUrl() | 84 self.url = self.SvnUrl() |
74 | 85 |
75 def testMembersChanged(self): | 86 def testMembersChanged(self): |
76 self.mox.ReplayAll() | 87 self.mox.ReplayAll() |
77 members = [ | 88 members = [ |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 self.assertTree(self.tree, self.svn_root) | 305 self.assertTree(self.tree, self.svn_root) |
295 # Asserting the tree is not sufficient, svn status must come out clear too. | 306 # Asserting the tree is not sufficient, svn status must come out clear too. |
296 self.assertEquals('', self._capture(['status'])) | 307 self.assertEquals('', self._capture(['status'])) |
297 | 308 |
298 | 309 |
299 if __name__ == '__main__': | 310 if __name__ == '__main__': |
300 import unittest | 311 import unittest |
301 unittest.main() | 312 unittest.main() |
302 | 313 |
303 # vim: ts=2:sw=2:tw=80:et: | 314 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |