| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2009 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 import shutil |
| 9 import tempfile | 9 import tempfile |
| 10 | 10 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 self.mox.ReplayAll() | 144 self.mox.ReplayAll() |
| 145 members = [ | 145 members = [ |
| 146 'COMMAND', 'Capture', 'CaptureHeadRevision', 'CaptureInfo', | 146 'COMMAND', 'Capture', 'CaptureHeadRevision', 'CaptureInfo', |
| 147 'CaptureStatus', 'DiffItem', 'GenerateDiff', 'GetCheckoutRoot', | 147 'CaptureStatus', 'DiffItem', 'GenerateDiff', 'GetCheckoutRoot', |
| 148 'GetEmail', 'GetFileProperty', 'IsMoved', | 148 'GetEmail', 'GetFileProperty', 'IsMoved', |
| 149 'ReadSimpleAuth', 'Run', 'RunAndFilterOutput', 'RunAndGetFileList', | 149 'ReadSimpleAuth', 'Run', 'RunAndFilterOutput', 'RunAndGetFileList', |
| 150 ] | 150 ] |
| 151 # If this test fails, you should add the relevant test. | 151 # If this test fails, you should add the relevant test. |
| 152 self.compareMembers(scm.SVN, members) | 152 self.compareMembers(scm.SVN, members) |
| 153 | 153 |
| 154 def testGetCheckoutRoot(self): |
| 155 self.mox.StubOutWithMock(scm.SVN, 'CaptureInfo') |
| 156 scm.os.path.abspath(self.root_dir + 'x').AndReturn(self.root_dir) |
| 157 result1 = { "Repository Root": "Some root" } |
| 158 scm.SVN.CaptureInfo(self.root_dir, print_error=False).AndReturn(result1) |
| 159 results2 = { "Repository Root": "A different root" } |
| 160 scm.SVN.CaptureInfo(scm.os.path.dirname(self.root_dir), |
| 161 print_error=False).AndReturn(results2) |
| 162 self.mox.ReplayAll() |
| 163 self.assertEquals(scm.SVN.GetCheckoutRoot(self.root_dir + 'x'), |
| 164 self.root_dir) |
| 165 |
| 154 def testGetFileInfo(self): | 166 def testGetFileInfo(self): |
| 155 xml_text = r"""<?xml version="1.0"?> | 167 xml_text = r"""<?xml version="1.0"?> |
| 156 <info> | 168 <info> |
| 157 <entry kind="file" path="%s" revision="14628"> | 169 <entry kind="file" path="%s" revision="14628"> |
| 158 <url>http://src.chromium.org/svn/trunk/src/chrome/app/d</url> | 170 <url>http://src.chromium.org/svn/trunk/src/chrome/app/d</url> |
| 159 <repository><root>http://src.chromium.org/svn</root></repository> | 171 <repository><root>http://src.chromium.org/svn</root></repository> |
| 160 <wc-info> | 172 <wc-info> |
| 161 <schedule>add</schedule> | 173 <schedule>add</schedule> |
| 162 <depth>infinity</depth> | 174 <depth>infinity</depth> |
| 163 <copy-from-url>http://src.chromium.org/svn/trunk/src/chrome/app/DEPS</copy-from-
url> | 175 <copy-from-url>http://src.chromium.org/svn/trunk/src/chrome/app/DEPS</copy-from-
url> |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 self.mox.ReplayAll() | 319 self.mox.ReplayAll() |
| 308 info = scm.SVN.CaptureStatus(None) | 320 info = scm.SVN.CaptureStatus(None) |
| 309 self.assertEquals(info, []) | 321 self.assertEquals(info, []) |
| 310 | 322 |
| 311 | 323 |
| 312 if __name__ == '__main__': | 324 if __name__ == '__main__': |
| 313 import unittest | 325 import unittest |
| 314 unittest.main() | 326 unittest.main() |
| 315 | 327 |
| 316 # vim: ts=2:sw=2:tw=80:et: | 328 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |