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

Unified Diff: tests/git_cl_test.py

Issue 1873233002: git cl checkout: implement for Gerrit + add test. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@G200-fox
Patch Set: 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
« 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 b8b694fa546ec3fdecd0674503843c934bc53a61..e94e9129a10219740c2893620c608dc9bcb3188a 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -1151,6 +1151,35 @@ class TestGitCl(TestCase):
git_cl.main(['patch',
'https://chromium-review.googlesource.com/#/c/123456/1'])
+ def _checkout_calls(self):
+ return [
+ ((['git', 'config', '--local', '--get-regexp',
+ 'branch\\..*\\.rietveldissue'], ),
+ ('branch.retrying.rietveldissue 1111111111\n'
+ 'branch.some-fix.rietveldissue 2222222222\n')),
+ ((['git', 'config', '--local', '--get-regexp',
+ 'branch\\..*\\.gerritissue'], ),
+ ('branch.ger-branch.gerritissue 123456\n'
+ 'branch.gbranch654.gerritissue 654321\n')),
+ ]
+
+ def test_checkout_gerrit(self):
+ """Tests git cl checkout <issue>."""
+ self.calls = self._checkout_calls()
+ self.calls += [((['git', 'checkout', 'ger-branch'], ), '')]
+ self.assertEqual(0, git_cl.main(['checkout', '123456']))
+
+ def test_checkout_rietveld(self):
+ """Tests git cl checkout <issue>."""
+ self.calls = self._checkout_calls()
+ self.calls += [((['git', 'checkout', 'some-fix'], ), '')]
+ self.assertEqual(0, git_cl.main(['checkout', '2222222222']))
+
+ def test_checkout_not_found(self):
+ """Tests git cl checkout <issue>."""
+ self.calls = self._checkout_calls()
+ self.assertEqual(1, git_cl.main(['checkout', '99999']))
+
if __name__ == '__main__':
git_cl.logging.basicConfig(
« 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