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

Unified Diff: tests/git_cl_test.py

Issue 2263103002: git cl issue: add --json switch for machine-readable output (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: tests 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 d4603ed3da7108aed8b306ed8bdff1c42e01790e..72020ffe5dcf80a63561cbdd7570fcf667dc3404 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -251,6 +251,8 @@ class TestGitCl(TestCase):
self.mock(git_cl, 'BranchExists', lambda _: True)
self.mock(git_cl, 'FindCodereviewSettingsFile', lambda: '')
self.mock(git_cl, 'ask_for_data', self._mocked_call)
+ self.mock(git_cl, 'write_json', lambda path, contents:
+ self._mocked_call('write_json', path, contents))
self.mock(git_cl.presubmit_support, 'DoPresubmitChecks', PresubmitMock)
self.mock(git_cl.rietveld, 'Rietveld', RietveldMock)
self.mock(git_cl.rietveld, 'CachingRietveld', RietveldMock)
@@ -1759,6 +1761,22 @@ class TestGitCl(TestCase):
]
self.assertEqual(0, git_cl.main(['issue', '0']))
+ def test_cmd_issue_json(self):
+ out = StringIO.StringIO()
+ self.mock(git_cl.sys, 'stdout', out)
+ self.calls = [
+ ((['git', 'symbolic-ref', 'HEAD'],), 'feature'),
+ ((['git', 'config', '--int', 'branch.feature.rietveldissue'],), '123'),
+ ((['git', 'config', 'rietveld.autoupdate'],), ''),
+ ((['git', 'config', 'rietveld.server'],),
+ 'https://codereview.chromium.org'),
+ ((['git', 'config', 'branch.feature.rietveldserver'],), ''),
+ (('write_json', 'output.json',
+ {'issue': 123, 'issue_url': 'https://codereview.chromium.org/123'}),
+ ''),
+ ]
+ self.assertEqual(0, git_cl.main(['issue', '--json', 'output.json']))
+
def test_git_cl_try_default(self):
self.mock(git_cl.Changelist, 'GetChange',
lambda _, *a: (
« 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