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

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: add more asserts 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..3e31a60a8129dcff6ddc66fa606678bd455d43a7 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:
+ 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')
+
+ out = StringIO.StringIO()
+ self.mock(git_cl.sys, 'stderr', out)
+
+ try:
+ 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')
+
+ def test_StatusFieldOverrideIssue(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)
« 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