Chromium Code Reviews| Index: tests/git_cl_test.py |
| diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py |
| index 3e31a60a8129dcff6ddc66fa606678bd455d43a7..48ec99068521d2784571bef437af38642c2b485c 100755 |
| --- a/tests/git_cl_test.py |
| +++ b/tests/git_cl_test.py |
| @@ -62,6 +62,10 @@ class RietveldMock(object): |
| ], |
| } |
| + @staticmethod |
| + def close_issue(_issue): |
| + return 'Closed' |
| + |
| class WatchlistsMock(object): |
| def __init__(self, _): |
| @@ -1540,7 +1544,7 @@ class TestGitCl(TestCase): |
| self.assertEqual(git_cl.main(['status', '--issue', '1']), 0) |
| except SystemExit as ex: |
| self.assertEqual(ex.code, 2) |
| - self.assertRegexpMatches(out.getvalue(), r'--issue may only be specified') |
| + self.assertRegexpMatches(out.getvalue(), r'--issue must be specified') |
| out = StringIO.StringIO() |
| self.mock(git_cl.sys, 'stderr', out) |
| @@ -1549,7 +1553,7 @@ class TestGitCl(TestCase): |
| self.assertEqual(git_cl.main(['status', '--issue', '1', '--rietveld']), 0) |
| except SystemExit as ex: |
| self.assertEqual(ex.code, 2) |
| - self.assertRegexpMatches(out.getvalue(), r'--issue may only be specified') |
| + self.assertRegexpMatches(out.getvalue(), r'--field must be specified') |
| def test_StatusFieldOverrideIssue(self): |
| out = StringIO.StringIO() |
| @@ -1565,9 +1569,44 @@ class TestGitCl(TestCase): |
| ((['git', 'config', 'rietveld.server'],), ''), |
| ((['git', 'config', 'rietveld.server'],), ''), |
| ] |
| - git_cl.main(['status', '--issue', '1', '--rietveld', '--field', 'desc']) |
| + self.assertEqual( |
| + git_cl.main(['status', '--issue', '1', '--rietveld', '--field', 'desc']), |
| + 0) |
| self.assertEqual(out.getvalue(), 'foobar\n') |
| + def test_SetCloseOverrideIssue(self): |
| + def assertIssue(cl_self, *_args): |
| + self.assertEquals(cl_self.issue, 1) |
| + return 'foobar' |
| + |
| + self.mock(git_cl.Changelist, 'GetDescription', assertIssue) |
| + self.mock(git_cl.Changelist, 'CloseIssue', lambda *_: None) |
| + self.calls = [ |
| + ((['git', 'config', 'rietveld.autoupdate'],), ''), |
| + ((['git', 'config', 'rietveld.server'],), ''), |
| + ((['git', 'config', 'rietveld.server'],), ''), |
| + ] |
| + self.assertEqual( |
| + git_cl.main(['set-close', '--issue', '1', '--rietveld']), 0) |
| + |
| + def test_SetCommitOverrideIssue(self): |
|
tandrii(chromium)
2016/08/17 21:05:31
and with this, commit-queue tool in depot_tools ca
iannucci
2016/08/17 21:37:08
:)
|
| + def assertIssue(cl_self, *_args): |
| + self.assertEquals(cl_self.issue, 1) |
| + return 'foobar' |
| + |
| + self.mock(git_cl.Changelist, 'GetDescription', assertIssue) |
| + self.mock(git_cl.Changelist, 'SetCQState', lambda *_: None) |
| + self.calls = [ |
| + ((['git', 'config', 'rietveld.autoupdate'],), ''), |
| + ((['git', 'config', 'rietveld.server'],), ''), |
| + ((['git', 'config', 'rietveld.server'],), ''), |
| + ((['git', 'symbolic-ref', 'HEAD'],), ''), |
| + ((['git', 'config', 'rietveld.server'],), ''), |
| + ((['git', 'config', 'rietveld.server'],), ''), |
| + ] |
| + self.assertEqual( |
| + git_cl.main(['set-close', '--issue', '1', '--rietveld']), 0) |
| + |
| def test_description_gerrit(self): |
| out = StringIO.StringIO() |
| self.mock(git_cl.sys, 'stdout', out) |