| Index: tests/gclient_test.py
|
| diff --git a/tests/gclient_test.py b/tests/gclient_test.py
|
| index c246efc4978c84395a241978593bb92a7564f9f5..66ddd46cab2431f4ad1a57ac2c2e597112f0dc2b 100755
|
| --- a/tests/gclient_test.py
|
| +++ b/tests/gclient_test.py
|
| @@ -907,6 +907,74 @@ class GclientTest(trial_dir.TestCase):
|
| ],
|
| self._get_processed())
|
|
|
| + def testDepsFromNotAllowedHostsUnspecified(self):
|
| + """Verifies gclient works fine with DEPS without allowed_hosts."""
|
| + write(
|
| + '.gclient',
|
| + 'solutions = [\n'
|
| + ' { "name": "foo", "url": "svn://example.com/foo",\n'
|
| + ' "deps_file" : ".DEPS.git",\n'
|
| + ' },\n'
|
| + ']')
|
| + write(
|
| + os.path.join('foo', 'DEPS'),
|
| + 'deps = {\n'
|
| + ' "bar": "/bar",\n'
|
| + '}')
|
| + options, _ = gclient.OptionParser().parse_args([])
|
| + obj = gclient.GClient.LoadCurrentConfig(options)
|
| + obj.RunOnDeps('None', [])
|
| + dep = obj.dependencies[0]
|
| + self.assertEquals([], dep.findDepsFromNotAllowedHosts())
|
| + self.assertIsNone(dep.allowed_hosts)
|
| + self._get_processed()
|
| +
|
| + def testDepsFromNotAllowedHostsOK(self):
|
| + """Verifies gclient works fine with DEPS with proper allowed_hosts."""
|
| + write(
|
| + '.gclient',
|
| + 'solutions = [\n'
|
| + ' { "name": "foo", "url": "svn://example.com/foo",\n'
|
| + ' "deps_file" : ".DEPS.git",\n'
|
| + ' },\n'
|
| + ']')
|
| + write(
|
| + os.path.join('foo', '.DEPS.git'),
|
| + 'allowed_hosts = ["example.com"]\n'
|
| + 'deps = {\n'
|
| + ' "bar": "svn://example.com/bar",\n'
|
| + '}')
|
| + options, _ = gclient.OptionParser().parse_args([])
|
| + obj = gclient.GClient.LoadCurrentConfig(options)
|
| + obj.RunOnDeps('None', [])
|
| + dep = obj.dependencies[0]
|
| + self.assertEquals([], dep.findDepsFromNotAllowedHosts())
|
| + self.assertEquals(('example.com', ), dep.allowed_hosts)
|
| + self._get_processed()
|
| +
|
| + def testDepsFromNotAllowedHostsBad(self):
|
| + """Verifies gclient works fine with DEPS with proper allowed_hosts."""
|
| + write(
|
| + '.gclient',
|
| + 'solutions = [\n'
|
| + ' { "name": "foo", "url": "svn://example.com/foo",\n'
|
| + ' "deps_file" : ".DEPS.git",\n'
|
| + ' },\n'
|
| + ']')
|
| + write(
|
| + os.path.join('foo', '.DEPS.git'),
|
| + 'allowed_hosts = ["other.com"]\n'
|
| + 'deps = {\n'
|
| + ' "bar": "svn://example.com/bar",\n'
|
| + '}')
|
| + options, _ = gclient.OptionParser().parse_args([])
|
| + obj = gclient.GClient.LoadCurrentConfig(options)
|
| + obj.RunOnDeps('None', [])
|
| + dep = obj.dependencies[0]
|
| + self.assertEquals(('other.com', ), dep.allowed_hosts)
|
| + self.assertEquals([dep.dependencies[0]], dep.findDepsFromNotAllowedHosts())
|
| + self._get_processed()
|
| +
|
|
|
| if __name__ == '__main__':
|
| sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout)
|
|
|