Index: tests/git_cl_test.py |
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py |
index 4797288258f946f4e363d82be8d850e39e45b99d..8eacfbbfe73e4ee28ccac82dd563897a69acae3b 100755 |
--- a/tests/git_cl_test.py |
+++ b/tests/git_cl_test.py |
@@ -1300,6 +1300,36 @@ class TestGitCl(TestCase): |
}) |
self.assertIsNone(cl.EnsureAuthenticated(force=False)) |
+ def test_cmd_set_commit_rietveld(self): |
+ self.mock(git_cl._RietveldChangelistImpl, 'SetFlag', |
+ lambda _, f, v: self._mocked_call(['SetFlag', f, v])) |
+ self.calls = [ |
+ ((['git', 'symbolic-ref', 'HEAD'],), 'feature'), |
+ ((['git', 'config', 'branch.feature.rietveldissue'],), '123'), |
+ ((['git', 'config', 'rietveld.autoupdate'],), ''), |
+ ((['git', 'config', 'rietveld.server'],), ''), |
+ ((['git', 'config', 'rietveld.server'],), ''), |
+ ((['git', 'config', 'branch.feature.rietveldserver'],), |
+ 'https://codereview.chromium.org'), |
+ ((['SetFlag', 'commit', '1'], ), ''), |
+ ] |
+ self.assertEqual(0, git_cl.main(['set-commit'])) |
Sergiy Byelozyorov
2016/04/13 17:15:03
also need a test for dry-run here
tandrii(chromium)
2016/04/13 17:17:16
see above - don't care about dry-run.
|
+ |
+ def test_cmd_set_commit_gerrit(self): |
+ self.mock(git_cl.gerrit_util, 'SetReview', |
+ lambda h, i, labels: self._mocked_call( |
+ ['SetReview', h, i, labels])) |
+ self.calls = [ |
+ ((['git', 'symbolic-ref', 'HEAD'],), 'feature'), |
+ ((['git', 'config', 'branch.feature.rietveldissue'],), ''), |
+ ((['git', 'config', 'branch.feature.gerritissue'],), '123'), |
+ ((['git', 'config', 'branch.feature.gerritserver'],), |
+ 'https://chromium-review.googlesource.com'), |
+ ((['SetReview', 'chromium-review.googlesource.com', 123, |
+ {'Commit-Queue': 1}],), ''), |
+ ] |
+ self.assertEqual(0, git_cl.main(['set-commit', '-d'])) |
Sergiy Byelozyorov
2016/04/13 17:15:03
do you test non-dry-run scenario?
tandrii(chromium)
2016/04/13 17:17:16
no, it's same codepath.
|
+ |
if __name__ == '__main__': |
git_cl.logging.basicConfig( |