Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1132)

Unified Diff: tests/gclient_scm_test.py

Issue 497053002: Use a regex instead of shlex.split() to get remote url (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Fix Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient_scm.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/gclient_scm_test.py
diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py
index 3dd175c69e292c1bb203216530b5c3833214c91b..163cc07457858af1a7c420e9cf2daf410f9370ce 100755
--- a/tests/gclient_scm_test.py
+++ b/tests/gclient_scm_test.py
@@ -88,6 +88,33 @@ class BaseTestCase(GCBaseTestCase, SuperMoxTestBase):
gclient_scm.GitWrapper.BinaryExists = self._original_GitBinaryExists
+class BasicTests(SuperMoxTestBase):
+ def setUp(self):
+ SuperMoxTestBase.setUp(self)
+
+ def testGetFirstRemoteUrl(self):
+ REMOTE_STRINGS = [('remote.origin.url E:\\foo\\bar', 'E:\\foo\\bar'),
+ ('remote.origin.url /b/foo/bar', '/b/foo/bar'),
+ ('remote.origin.url https://foo/bar', 'https://foo/bar'),
+ ('remote.origin.url E:\\Fo Bar\\bax', 'E:\\Fo Bar\\bax'),
+ ('remote.origin.url git://what/"do', 'git://what/"do')]
+ FAKE_PATH = '/fake/path'
+ self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'Capture')
+ for question, _ in REMOTE_STRINGS:
+ gclient_scm.scm.GIT.Capture(
+ ['config', '--local', '--get-regexp', r'remote.*.url'],
+ cwd=FAKE_PATH).AndReturn(question)
+
+ self.mox.ReplayAll()
+
+ for _, answer in REMOTE_STRINGS:
+ self.assertEquals(gclient_scm.SCMWrapper._get_first_remote_url(FAKE_PATH),
+ answer)
+
+ def tearDown(self):
+ SuperMoxTestBase.tearDown(self)
+
+
class SVNWrapperTestCase(BaseTestCase):
class OptionsObject(object):
def __init__(self, verbose=False, revision=None, force=False):
« no previous file with comments | « gclient_scm.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698