Commit d9e5ce51 authored by tandrii's avatar tandrii Committed by Commit bot

Fix git cl set-commit --clear.

  aka sergiyb@ was right.

R=sergiyb@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2141283002
parent 83e44427
......@@ -4742,7 +4742,7 @@ def CMDset_commit(parser, args):
cl = Changelist(auth_config=auth_config)
if options.clear:
state = _CQState.CLEAR
state = _CQState.NONE
elif options.dry_run:
state = _CQState.DRY_RUN
else:
......
......@@ -1480,7 +1480,7 @@ class TestGitCl(TestCase):
]
self.assertEqual(0, git_cl.main(['set-commit']))
def test_cmd_set_commit_gerrit(self):
def _cmd_set_commit_gerrit_common(self, vote):
self.mock(git_cl.gerrit_util, 'SetReview',
lambda h, i, labels: self._mocked_call(
['SetReview', h, i, labels]))
......@@ -1491,13 +1491,21 @@ class TestGitCl(TestCase):
((['git', 'config', 'branch.feature.gerritserver'],),
'https://chromium-review.googlesource.com'),
((['SetReview', 'chromium-review.googlesource.com', 123,
{'Commit-Queue': 1}],), ''),
{'Commit-Queue': vote}],), ''),
]
# TODO(tandrii): consider testing just set-commit and set-commit --clear,
# but without copy-pasting tons of expectations, as modifying them later is
# super tedious.
def test_cmd_set_commit_gerrit_clear(self):
self._cmd_set_commit_gerrit_common(0)
self.assertEqual(0, git_cl.main(['set-commit', '-c']))
def test_cmd_set_commit_gerrit_dry(self):
self._cmd_set_commit_gerrit_common(1)
self.assertEqual(0, git_cl.main(['set-commit', '-d']))
def test_cmd_set_commit_gerrit(self):
self._cmd_set_commit_gerrit_common(2)
self.assertEqual(0, git_cl.main(['set-commit']))
def test_description_display(self):
out = StringIO.StringIO()
self.mock(git_cl.sys, 'stdout', out)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment