Index: tests/gclient_utils_test.py |
diff --git a/tests/gclient_utils_test.py b/tests/gclient_utils_test.py |
index 7180d961abdeca2d34f0697a7913c95f4f02160f..fbf56ae6679526227d2f04b597d3052cc9ed5203 100755 |
--- a/tests/gclient_utils_test.py |
+++ b/tests/gclient_utils_test.py |
@@ -35,7 +35,8 @@ class GclientUtilsUnittest(GclientUtilBase): |
'MakeDateRevision', 'MakeFileAutoFlush', 'MakeFileAnnotated', |
'PathDifference', 'ParseCodereviewSettingsContent', |
'PrintableObject', 'RemoveDirectory', 'RunEditor', |
- 'SplitUrlRevision', 'SyntaxErrorToError', 'Wrapper', 'WorkItem', |
+ 'SplitUrlRevision', 'SyntaxErrorToError', |
+ 'UpgradeToHttps', 'Wrapper', 'WorkItem', |
'errno', 'lockedmethod', 'logging', 'os', 'Queue', 're', 'rmtree', |
'safe_makedirs', 'stat', 'subprocess2', 'sys', 'tempfile', 'threading', |
'time', |
@@ -171,20 +172,37 @@ class GClientUtilsTest(trial_dir.TestCase): |
os.chmod(l2, 0) |
os.chmod(l1, 0) |
+ def testUpgradeToHttps(self): |
+ values = [ |
+ ['', ''], |
+ [None, None], |
+ ['foo', 'https://foo'], |
+ ['http://foo', 'https://foo'], |
+ ['ssh-svn://foo', 'ssh-svn://foo'], |
+ ] |
+ for content, expected in values: |
+ self.assertEquals( |
+ expected, gclient_utils.UpgradeToHttps(content)) |
+ |
def testParseCodereviewSettingsContent(self): |
- expected = { |
- 'Foo': 'bar:baz', |
- 'Second': 'value', |
- } |
- content = ( |
- '# bleh\n' |
- '\t# foo : bar\n' |
- 'Foo:bar:baz\n' |
- ' Second : value \n\r' |
- '#inconsistency' |
- ) |
- self.assertEquals( |
- expected, gclient_utils.ParseCodereviewSettingsContent(content)) |
+ values = [ |
+ ['# bleh\n', {}], |
+ ['\t# foo : bar\n', {}], |
+ ['Foo:bar', {'Foo': 'bar'}], |
+ ['Foo:bar:baz\n', {'Foo': 'bar:baz'}], |
+ [' Foo : bar ', {'Foo': 'bar'}], |
+ [' Foo : bar \n', {'Foo': 'bar'}], |
+ ['a:b\n\rc:d\re:f', {'a': 'b', 'c': 'd', 'e': 'f'}], |
+ ['an_url:http://value/', {'an_url': 'http://value/'}], |
+ [ |
+ 'CODE_REVIEW_SERVER : http://r/s', |
+ {'CODE_REVIEW_SERVER': 'https://r/s'} |
+ ], |
+ ['VIEW_VC:http://r/s', {'VIEW_VC': 'https://r/s'}], |
+ ] |
+ for content, expected in values: |
+ self.assertEquals( |
+ expected, gclient_utils.ParseCodereviewSettingsContent(content)) |
if __name__ == '__main__': |