OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 os | 6 import os |
7 import StringIO | 7 import StringIO |
8 import sys | 8 import sys |
9 | 9 |
10 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | 10 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 values = [ | 157 values = [ |
158 ['', ''], | 158 ['', ''], |
159 [None, None], | 159 [None, None], |
160 ['foo', 'https://foo'], | 160 ['foo', 'https://foo'], |
161 ['http://foo', 'https://foo'], | 161 ['http://foo', 'https://foo'], |
162 ['foo/', 'https://foo/'], | 162 ['foo/', 'https://foo/'], |
163 ['ssh-svn://foo', 'ssh-svn://foo'], | 163 ['ssh-svn://foo', 'ssh-svn://foo'], |
164 ['ssh-svn://foo/bar/', 'ssh-svn://foo/bar/'], | 164 ['ssh-svn://foo/bar/', 'ssh-svn://foo/bar/'], |
165 ['codereview.chromium.org', 'https://codereview.chromium.org'], | 165 ['codereview.chromium.org', 'https://codereview.chromium.org'], |
166 ['codereview.chromium.org/', 'https://codereview.chromium.org/'], | 166 ['codereview.chromium.org/', 'https://codereview.chromium.org/'], |
167 ['http://foo:8080', 'http://foo:8080'], | 167 ['http://foo:10000', 'http://foo:10000'], |
168 ['http://foo:8080/bar', 'http://foo:8080/bar'], | 168 ['http://foo:10000/bar', 'http://foo:10000/bar'], |
169 ['foo:8080', 'http://foo:8080'], | 169 ['foo:10000', 'http://foo:10000'], |
170 ['foo:', 'https://foo:'], | 170 ['foo:', 'https://foo:'], |
171 ] | 171 ] |
172 for content, expected in values: | 172 for content, expected in values: |
173 self.assertEquals( | 173 self.assertEquals( |
174 expected, gclient_utils.UpgradeToHttps(content)) | 174 expected, gclient_utils.UpgradeToHttps(content)) |
175 | 175 |
176 def testParseCodereviewSettingsContent(self): | 176 def testParseCodereviewSettingsContent(self): |
177 values = [ | 177 values = [ |
178 ['# bleh\n', {}], | 178 ['# bleh\n', {}], |
179 ['\t# foo : bar\n', {}], | 179 ['\t# foo : bar\n', {}], |
(...skipping 12 matching lines...) Expand all Loading... |
192 for content, expected in values: | 192 for content, expected in values: |
193 self.assertEquals( | 193 self.assertEquals( |
194 expected, gclient_utils.ParseCodereviewSettingsContent(content)) | 194 expected, gclient_utils.ParseCodereviewSettingsContent(content)) |
195 | 195 |
196 | 196 |
197 if __name__ == '__main__': | 197 if __name__ == '__main__': |
198 import unittest | 198 import unittest |
199 unittest.main() | 199 unittest.main() |
200 | 200 |
201 # vim: ts=2:sw=2:tw=80:et: | 201 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |