| 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 20 matching lines...) Expand all Loading... |
| 31 self.mox.StubOutWithMock(scm.gclient_utils, 'CheckCallAndFilter') | 31 self.mox.StubOutWithMock(scm.gclient_utils, 'CheckCallAndFilter') |
| 32 self.mox.StubOutWithMock(scm.gclient_utils, 'CheckCallAndFilterAndHeader') | 32 self.mox.StubOutWithMock(scm.gclient_utils, 'CheckCallAndFilterAndHeader') |
| 33 self.mox.StubOutWithMock(scm.gclient_utils, 'Popen') | 33 self.mox.StubOutWithMock(scm.gclient_utils, 'Popen') |
| 34 | 34 |
| 35 | 35 |
| 36 class RootTestCase(BaseSCMTestCase): | 36 class RootTestCase(BaseSCMTestCase): |
| 37 def testMembersChanged(self): | 37 def testMembersChanged(self): |
| 38 self.mox.ReplayAll() | 38 self.mox.ReplayAll() |
| 39 members = [ | 39 members = [ |
| 40 'GetCasedPath', 'GenFakeDiff', 'GIT', 'SVN', 'ValidateEmail', | 40 'GetCasedPath', 'GenFakeDiff', 'GIT', 'SVN', 'ValidateEmail', |
| 41 'cStringIO', 'gclient_utils', 'glob', 'os', 're', 'shutil', | 41 'cStringIO', 'gclient_utils', 'glob', 'logging', 'os', 're', 'shutil', |
| 42 'subprocess', 'sys', 'tempfile', 'time', 'xml', | 42 'subprocess', 'sys', 'tempfile', 'time', 'xml', |
| 43 ] | 43 ] |
| 44 # If this test fails, you should add the relevant test. | 44 # If this test fails, you should add the relevant test. |
| 45 self.compareMembers(scm, members) | 45 self.compareMembers(scm, members) |
| 46 | 46 |
| 47 | 47 |
| 48 class GitWrapperTestCase(BaseSCMTestCase): | 48 class GitWrapperTestCase(BaseSCMTestCase): |
| 49 def testMembersChanged(self): | 49 def testMembersChanged(self): |
| 50 members = [ | 50 members = [ |
| 51 'AssertVersion', 'Capture', 'CaptureStatus', | 51 'AssertVersion', 'Capture', 'CaptureStatus', |
| (...skipping 18 matching lines...) Expand all Loading... |
| 70 BaseSCMTestCase.setUp(self) | 70 BaseSCMTestCase.setUp(self) |
| 71 self.mox.StubOutWithMock(scm.SVN, 'Capture') | 71 self.mox.StubOutWithMock(scm.SVN, 'Capture') |
| 72 self.url = self.SvnUrl() | 72 self.url = self.SvnUrl() |
| 73 | 73 |
| 74 def testMembersChanged(self): | 74 def testMembersChanged(self): |
| 75 self.mox.ReplayAll() | 75 self.mox.ReplayAll() |
| 76 members = [ | 76 members = [ |
| 77 'AssertVersion', 'Capture', 'CaptureRevision', 'CaptureInfo', | 77 'AssertVersion', 'Capture', 'CaptureRevision', 'CaptureInfo', |
| 78 'CaptureStatus', 'current_version', 'DiffItem', 'GenerateDiff', | 78 'CaptureStatus', 'current_version', 'DiffItem', 'GenerateDiff', |
| 79 'GetCheckoutRoot', 'GetEmail', 'GetFileProperty', 'IsMoved', | 79 'GetCheckoutRoot', 'GetEmail', 'GetFileProperty', 'IsMoved', |
| 80 'IsMovedInfo', 'ReadSimpleAuth', 'RunAndGetFileList', | 80 'IsMovedInfo', 'ReadSimpleAuth', 'Revert', 'RunAndGetFileList', |
| 81 ] | 81 ] |
| 82 # If this test fails, you should add the relevant test. | 82 # If this test fails, you should add the relevant test. |
| 83 self.compareMembers(scm.SVN, members) | 83 self.compareMembers(scm.SVN, members) |
| 84 | 84 |
| 85 def testGetCheckoutRoot(self): | 85 def testGetCheckoutRoot(self): |
| 86 self.mox.StubOutWithMock(scm.SVN, 'CaptureInfo') | 86 self.mox.StubOutWithMock(scm.SVN, 'CaptureInfo') |
| 87 self.mox.StubOutWithMock(scm, 'GetCasedPath') | 87 self.mox.StubOutWithMock(scm, 'GetCasedPath') |
| 88 scm.os.path.abspath(self.root_dir + 'x').AndReturn(self.root_dir) | 88 scm.os.path.abspath(self.root_dir + 'x').AndReturn(self.root_dir) |
| 89 scm.GetCasedPath(self.root_dir).AndReturn(self.root_dir) | 89 scm.GetCasedPath(self.root_dir).AndReturn(self.root_dir) |
| 90 result1 = { "Repository Root": "Some root" } | 90 result1 = { "Repository Root": "Some root" } |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 self.mox.ReplayAll() | 231 self.mox.ReplayAll() |
| 232 info = scm.SVN.CaptureStatus(None) | 232 info = scm.SVN.CaptureStatus(None) |
| 233 self.assertEquals(info, []) | 233 self.assertEquals(info, []) |
| 234 | 234 |
| 235 | 235 |
| 236 if __name__ == '__main__': | 236 if __name__ == '__main__': |
| 237 import unittest | 237 import unittest |
| 238 unittest.main() | 238 unittest.main() |
| 239 | 239 |
| 240 # vim: ts=2:sw=2:tw=80:et: | 240 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |