 Chromium Code Reviews
 Chromium Code Reviews Issue 61623008:
  If the destination directory doesn't contain the desired repo, delete it  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
    
  
    Issue 61623008:
  If the destination directory doesn't contain the desired repo, delete it  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master| Index: tests/gclient_scm_test.py | 
| diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py | 
| index 65b4ba7bdd74b7c1c02bd3f78249c28327dc5951..2fc05e329f39d3fad9945b465de55dd17753cbf5 100755 | 
| --- a/tests/gclient_scm_test.py | 
| +++ b/tests/gclient_scm_test.py | 
| @@ -102,6 +102,7 @@ class SVNWrapperTestCase(BaseTestCase): | 
| 'BinaryExists', | 
| 'FullUrlForRelativeUrl', | 
| 'GetCheckoutRoot', | 
| + 'GetRemoteURL', | 
| 'GetRevisionDate', | 
| 'GetUsableRev', | 
| 'Svnversion', | 
| @@ -692,6 +693,48 @@ class SVNWrapperTestCase(BaseTestCase): | 
| self.assertRaises(gclient_scm.gclient_utils.Error, | 
| svn_scm.GetUsableRev, 'fake', options) | 
| + def testGetRemoteURL(self): | 
| + self.mox.UnsetStubs() | 
| + options = self.Options(verbose=True) | 
| + self.mox.StubOutWithMock(gclient_scm.scm.SVN, 'Capture', True) | 
| 
borenet
2013/11/25 13:55:42
The test failed without adding these lines, presum
 | 
| + svn_scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 
| + relpath=self.relpath) | 
| + | 
| + if svn_scm.relpath: | 
| + cwd = os.path.join(svn_scm._root_dir, svn_scm.relpath) | 
| + else: | 
| + cwd = svn_scm._root_dir | 
| + | 
| + gclient_scm.scm.SVN.Capture(['info', '--xml', os.curdir], cwd).AndReturn( | 
| +"""<?xml version="1.0"?> | 
| +<info> | 
| +<entry | 
| + path="." | 
| + revision="1234" | 
| + kind="dir"> | 
| +<url>%s</url> | 
| +<repository> | 
| +<root>https://dummy.repo.com/svn</root> | 
| +<uuid>FAKE</uuid> | 
| +</repository> | 
| +<wc-info> | 
| +<schedule>normal</schedule> | 
| +<depth>infinity</depth> | 
| +</wc-info> | 
| +<commit | 
| + revision="1234"> | 
| +<author>fakedev@chromium.org</author> | 
| +<date>2013-11-14T15:08:21.757885Z</date> | 
| +</commit> | 
| +</entry> | 
| +</info> | 
| +""" % svn_scm.url) | 
| + | 
| + self.mox.ReplayAll() | 
| + | 
| + self.assertEquals(svn_scm.GetRemoteURL(options), self.url) | 
| + | 
| + | 
| class BaseGitWrapperTestCase(GCBaseTestCase, StdoutCheck, TestCaseUtils, | 
| unittest.TestCase): | 
| """This class doesn't use pymox.""" | 
| @@ -813,6 +856,7 @@ class ManagedGitWrapperTestCase(BaseGitWrapperTestCase): | 
| 'BinaryExists', | 
| 'FullUrlForRelativeUrl', | 
| 'GetCheckoutRoot', | 
| + 'GetRemoteURL', | 
| 'GetRevisionDate', | 
| 'GetUsableRev', | 
| 'RunCommand', | 
| @@ -1180,6 +1224,18 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase): | 
| self.assertRaises(gclient_scm.gclient_utils.Error, | 
| git_svn_scm.GetUsableRev, too_big, options) | 
| + def testGetRemoteURL(self): | 
| + options = self.Options(verbose=True) | 
| + self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Capture', True) | 
| + git_scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 
| + relpath=self.relpath) | 
| + git_scm._Capture(['config', 'remote.origin.url'], cwd='/tmp/fake' | 
| + ).AndReturn('%s\n' % git_scm.url) | 
| + | 
| + self.mox.ReplayAll() | 
| + | 
| + self.assertEquals(git_scm.GetRemoteURL(options), self.url) | 
| + | 
| class UnmanagedGitWrapperTestCase(BaseGitWrapperTestCase): | 
| def testUpdateUpdate(self): |