Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1134)

Unified Diff: tests/git_cl_test.py

Issue 2245263007: Add --issue to set-commit and set-close too. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « git_cl.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « git_cl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698