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

Unified Diff: tests/git_cl_test.py

Issue 2250323003: Add --issue flag to git cl status. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: fix comment 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 378525a005eda3b575e93359895be8b0ff12abbd..43f79280341ba5cb2e6452df5585fa566d6e1874 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -1532,6 +1532,42 @@ class TestGitCl(TestCase):
'description', 'https://code.review.org/123123', '-d', '--rietveld']))
self.assertEqual('foobar\n', out.getvalue())
+ def test_StatusFieldOverrideIssueMissingArgs(self):
+ out = StringIO.StringIO()
+ self.mock(git_cl.sys, 'stderr', out)
+
+ try:
+ git_cl.main(['status', '--issue', '1'])
tandrii(chromium) 2016/08/17 20:16:32 add assert 0 :)
iannucci 2016/08/17 20:20:36 done
+ except SystemExit as ex:
+ self.assertEqual(ex.code, 2)
+ self.assertRegexpMatches(out.getvalue(), r'--issue may only be specified')
+
+ out = StringIO.StringIO()
+ self.mock(git_cl.sys, 'stderr', out)
+
+ try:
+ git_cl.main(['status', '--issue', '1', '--rietveld'])
tandrii(chromium) 2016/08/17 20:16:32 ditto
iannucci 2016/08/17 20:20:36 done
+ except SystemExit as ex:
+ self.assertEqual(ex.code, 2)
+ self.assertRegexpMatches(out.getvalue(), r'--issue may only be specified')
+
+ def test_StatusFieldOverrideIssueMissingArgs(self):
+ out = StringIO.StringIO()
+ self.mock(git_cl.sys, 'stdout', out)
+
+ def assertIssue(cl_self, *_args):
+ self.assertEquals(cl_self.issue, 1)
+ return 'foobar'
+
+ self.mock(git_cl.Changelist, 'GetDescription', assertIssue)
+ self.calls = [
+ ((['git', 'config', 'rietveld.autoupdate'],), ''),
+ ((['git', 'config', 'rietveld.server'],), ''),
+ ((['git', 'config', 'rietveld.server'],), ''),
+ ]
+ git_cl.main(['status', '--issue', '1', '--rietveld', '--field', 'desc'])
+ self.assertEqual(out.getvalue(), 'foobar\n')
+
def test_description_gerrit(self):
out = StringIO.StringIO()
self.mock(git_cl.sys, 'stdout', out)
@@ -1758,6 +1794,7 @@ class TestGitCl(TestCase):
cl._codereview_impl._GerritCommitMsgHookCheck(offer_removal=True)
+
tandrii(chromium) 2016/08/17 20:16:32 delete
iannucci 2016/08/17 20:20:36 done in later patchset :)
if __name__ == '__main__':
git_cl.logging.basicConfig(
level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR)
« 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