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

Unified Diff: tests/git_cl_test.py

Issue 1889483002: git cl set-commit: for Gerrit + dry-run support. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: review Created 4 years, 8 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
« git_cl.py ('K') | « 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 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(
« git_cl.py ('K') | « git_cl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698