Chromium Code Reviews| Index: tests/gclient_scm_test.py |
| diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py |
| index 65b4ba7bdd74b7c1c02bd3f78249c28327dc5951..310f5ae42c1ff091c581c66168b5f1151f38ef4e 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,35 @@ class SVNWrapperTestCase(BaseTestCase): |
| self.assertRaises(gclient_scm.gclient_utils.Error, |
| svn_scm.GetUsableRev, 'fake', options) |
| + def testGetRemoteURL(self): |
| + options = self.Options(verbose=True) |
| + 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', os.curdir], cwd).AndReturn( |
| +""" |
| +Path: . |
| +URL: %s |
| +Repository Root: https://dummy.repo.com/svn |
| +Repository UUID: FAKE |
| +Revision: 1234 |
| +Node Kind: directory |
| +Schedule: normal |
| +Last Changed Author: fakedev@chromium.org |
| +Last Changed Rev: 1234 |
| +Last Changed Date: 2013-11-11 15:12:34 -0500 (Mon, 11 Nov 2013) |
| +""" % 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 +843,7 @@ class ManagedGitWrapperTestCase(BaseGitWrapperTestCase): |
| 'BinaryExists', |
| 'FullUrlForRelativeUrl', |
| 'GetCheckoutRoot', |
| + 'GetRemoteURL', |
| 'GetRevisionDate', |
| 'GetUsableRev', |
| 'RunCommand', |
| @@ -1180,6 +1211,21 @@ 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(['remote', '-v']).AndReturn( |
| +""" |
| +origin %s (fetch) |
| +origin %s (push) |
|
iannucci
2013/11/13 06:26:30
nit: you could do %(url)s in the string and then s
borenet
2013/11/13 19:12:24
Done. I'll leave the "origin" --> REMOTE_NAME refa
|
| +""" % (git_scm.url, git_scm.url)) |
| + |
| + self.mox.ReplayAll() |
| + |
| + self.assertEquals(git_scm.GetRemoteURL(options), self.url) |
| + |
| class UnmanagedGitWrapperTestCase(BaseGitWrapperTestCase): |
| def testUpdateUpdate(self): |