| Index: tests/gclient_smoketest.py
|
| diff --git a/tests/gclient_smoketest.py b/tests/gclient_smoketest.py
|
| index 4433a5e6f1d3653bedc34ba75d85069bed7a47f9..2befa0a3b289f69a07a3ff8975078ba37ec6dbb9 100755
|
| --- a/tests/gclient_smoketest.py
|
| +++ b/tests/gclient_smoketest.py
|
| @@ -134,13 +134,19 @@ class GClientSmokeBase(unittest.TestCase):
|
|
|
|
|
| class GClientSmoke(GClientSmokeBase):
|
| - def testCommands(self):
|
| - """This test is to make sure no new command was added."""
|
| + def testHelp(self):
|
| + """testHelp: make sure no new command was added."""
|
| result = self.gclient(['help'])
|
| self.assertEquals(1197, len(result[0]))
|
| self.assertEquals(0, len(result[1]))
|
| self.assertEquals(0, result[2])
|
|
|
| + def testUnknown(self):
|
| + result = self.gclient(['foo'])
|
| + self.assertEquals(1197, len(result[0]))
|
| + self.assertEquals(0, len(result[1]))
|
| + self.assertEquals(0, result[2])
|
| +
|
| def testNotConfigured(self):
|
| res = ('', 'Error: client not configured; see \'gclient config\'\n', 1)
|
| self.check(res, self.gclient(['cleanup']))
|
| @@ -154,10 +160,57 @@ class GClientSmoke(GClientSmokeBase):
|
| self.check(res, self.gclient(['sync']))
|
| self.check(res, self.gclient(['update']))
|
|
|
| + def testConfig(self):
|
| + p = join(self.root_dir, '.gclient')
|
| + def test(cmd, expected):
|
| + if os.path.exists(p):
|
| + os.remove(p)
|
| + results = self.gclient(cmd)
|
| + self.check(('', '', 0), results)
|
| + self.checkString(expected, open(p, 'rb').read())
|
| +
|
| + test(['config', self.svn_base + 'trunk/src/'],
|
| + 'solutions = [\n'
|
| + ' { "name" : "src",\n'
|
| + ' "url" : "svn://127.0.0.1/svn/trunk/src",\n'
|
| + ' "custom_deps" : {\n'
|
| + ' },\n'
|
| + ' "safesync_url": ""\n'
|
| + ' },\n]\n')
|
| +
|
| + test(['config', self.git_base + 'repo_1', '--name', 'src'],
|
| + 'solutions = [\n'
|
| + ' { "name" : "src",\n'
|
| + ' "url" : "git://127.0.0.1/git/repo_1",\n'
|
| + ' "custom_deps" : {\n'
|
| + ' },\n'
|
| + ' "safesync_url": ""\n'
|
| + ' },\n]\n')
|
| +
|
| + test(['config', 'foo', 'faa'],
|
| + 'solutions = [\n'
|
| + ' { "name" : "foo",\n'
|
| + ' "url" : "foo",\n'
|
| + ' "custom_deps" : {\n'
|
| + ' },\n'
|
| + ' "safesync_url": "faa"\n'
|
| + ' },\n]\n')
|
| +
|
| + test(['config', '--spec', '["blah blah"]'], '["blah blah"]')
|
| +
|
| + os.remove(p)
|
| + results = self.gclient(['config', 'foo', 'faa', 'fuu'])
|
| + err = ('Usage: gclient.py config [options] [url] [safesync url]\n\n'
|
| + 'gclient.py: error: Inconsistent arguments. Use either --spec or one'
|
| + ' or 2 args\n')
|
| + self.check(('', err, 2), results)
|
| + self.assertFalse(os.path.exists(join(self.root_dir, '.gclient')))
|
| +
|
|
|
| class GClientSmokeSVN(GClientSmokeBase):
|
| - """sync is the most important command. Hence test it more."""
|
| def testSync(self):
|
| + # TODO(maruel): safesync, multiple solutions, invalid@revisions,
|
| + # multiple revisions.
|
| self.gclient(['config', self.svn_base + 'trunk/src/'])
|
| # Test unversioned checkout.
|
| results = self.gclient(['sync', '--deps', 'mac'])
|
| @@ -304,6 +357,8 @@ class GClientSmokeSVN(GClientSmokeBase):
|
|
|
| class GClientSmokeGIT(GClientSmokeBase):
|
| def testSync(self):
|
| + # TODO(maruel): safesync, multiple solutions, invalid@revisions,
|
| + # multiple revisions.
|
| self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
|
| # Test unversioned checkout.
|
| results = self.gclient(['sync', '--deps', 'mac'])
|
| @@ -417,6 +472,22 @@ class GClientSmokeGIT(GClientSmokeBase):
|
| self.checkString('', results[1])
|
| self.assertEquals(0, results[2])
|
|
|
| + def testRevInfo(self):
|
| + # TODO(maruel): Test multiple solutions.
|
| + self.gclient(['config', self.git_base + 'repo_1', '--name', 'src'])
|
| + self.gclient(['sync', '--deps', 'mac'])
|
| + results = self.gclient(['revinfo'])
|
| + out = ('src: %(base)srepo_1@%(hash1)s;\n'
|
| + 'src/repo2: %(base)srepo_2@%(hash2)s;\n'
|
| + 'src/repo2/repo_renamed: %(base)srepo_3@%(hash3)s\n' %
|
| + {
|
| + 'base': self.git_base,
|
| + 'hash1': FAKE.git_hashes['repo_1'][1][0],
|
| + 'hash2': FAKE.git_hashes['repo_2'][0][0],
|
| + 'hash3': FAKE.git_hashes['repo_3'][1][0],
|
| + })
|
| + self.check((out, '', 0), results)
|
| +
|
|
|
| if __name__ == '__main__':
|
| if '-v' in sys.argv:
|
|
|