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

Side by Side Diff: tests/gclient_utils_test.py

Issue 391048: gclient: fix another bug where ssh urls weren't parsed correctly (Closed)
Patch Set: fix per code review Created 11 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « gclient_utils.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import re 6 import re
7 import StringIO 7 import StringIO
8 8
9 import gclient_utils 9 import gclient_utils
10 from super_mox import SuperMoxTestBase 10 from super_mox import SuperMoxTestBase
(...skipping 28 matching lines...) Expand all
39 if match: 39 if match:
40 capture_list.append(match.group(1)) 40 capture_list.append(match.group(1))
41 gclient_utils.SubprocessCallAndFilter( 41 gclient_utils.SubprocessCallAndFilter(
42 command, in_directory, 42 command, in_directory,
43 True, True, 43 True, True,
44 fail_status, FilterLines) 44 fail_status, FilterLines)
45 self.assertEquals(line_list, ['ahah', 'accb', 'allo', 'addb']) 45 self.assertEquals(line_list, ['ahah', 'accb', 'allo', 'addb'])
46 self.assertEquals(capture_list, ['cc', 'dd']) 46 self.assertEquals(capture_list, ['cc', 'dd'])
47 47
48 48
49 class SplitUrlRevisionTestCase(SuperMoxTestBase):
50 def testSSHUrl(self):
51 url = "ssh://test@example.com/test.git"
52 rev = "ac345e52dc"
53 out_url, out_rev = gclient_utils.SplitUrlRevision(url)
54 self.assertEquals(out_rev, None)
55 self.assertEquals(out_url, url)
56 out_url, out_rev = gclient_utils.SplitUrlRevision("%s@%s" % (url, rev))
57 self.assertEquals(out_rev, rev)
58 self.assertEquals(out_url, url)
59 url = "ssh://example.com/test.git"
60 out_url, out_rev = gclient_utils.SplitUrlRevision(url)
61 self.assertEquals(out_rev, None)
62 self.assertEquals(out_url, url)
63 out_url, out_rev = gclient_utils.SplitUrlRevision("%s@%s" % (url, rev))
64 self.assertEquals(out_rev, rev)
65 self.assertEquals(out_url, url)
66
67 def testSVNUrl(self):
68 url = "svn://example.com/test"
69 rev = "ac345e52dc"
70 out_url, out_rev = gclient_utils.SplitUrlRevision(url)
71 self.assertEquals(out_rev, None)
72 self.assertEquals(out_url, url)
73 out_url, out_rev = gclient_utils.SplitUrlRevision("%s@%s" % (url, rev))
74 self.assertEquals(out_rev, rev)
75 self.assertEquals(out_url, url)
76
77
49 if __name__ == '__main__': 78 if __name__ == '__main__':
50 import unittest 79 import unittest
51 unittest.main() 80 unittest.main()
52 81
53 # vim: ts=2:sw=2:tw=80:et: 82 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « gclient_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698