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

Side by Side Diff: tests/git_cl_test.py

Issue 2184643004: git cl set-commit: fix for Rietveld if cq dry run is active. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « git_cl.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Unit tests for git_cl.py.""" 6 """Unit tests for git_cl.py."""
7 7
8 import os 8 import os
9 import StringIO 9 import StringIO
10 import stat 10 import stat
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 'chromium-review.googlesource.com': 'same', 1459 'chromium-review.googlesource.com': 'same',
1460 }) 1460 })
1461 self.assertIsNone(cl.EnsureAuthenticated(force=False)) 1461 self.assertIsNone(cl.EnsureAuthenticated(force=False))
1462 1462
1463 def test_gerrit_ensure_authenticated_skipped(self): 1463 def test_gerrit_ensure_authenticated_skipped(self):
1464 cl = self._test_gerrit_ensure_authenticated_common( 1464 cl = self._test_gerrit_ensure_authenticated_common(
1465 auth={}, skip_auth_check=True) 1465 auth={}, skip_auth_check=True)
1466 self.assertIsNone(cl.EnsureAuthenticated(force=False)) 1466 self.assertIsNone(cl.EnsureAuthenticated(force=False))
1467 1467
1468 def test_cmd_set_commit_rietveld(self): 1468 def test_cmd_set_commit_rietveld(self):
1469 self.mock(git_cl._RietveldChangelistImpl, 'SetFlag', 1469 self.mock(git_cl._RietveldChangelistImpl, 'SetFlags',
1470 lambda _, f, v: self._mocked_call(['SetFlag', f, v])) 1470 lambda _, v: self._mocked_call(['SetFlags', v]))
1471 self.calls = [ 1471 self.calls = [
1472 ((['git', 'symbolic-ref', 'HEAD'],), 'feature'), 1472 ((['git', 'symbolic-ref', 'HEAD'],), 'feature'),
1473 ((['git', 'config', 'branch.feature.rietveldissue'],), '123'), 1473 ((['git', 'config', 'branch.feature.rietveldissue'],), '123'),
1474 ((['git', 'config', 'rietveld.autoupdate'],), ''), 1474 ((['git', 'config', 'rietveld.autoupdate'],), ''),
1475 ((['git', 'config', 'rietveld.server'],), ''), 1475 ((['git', 'config', 'rietveld.server'],), ''),
1476 ((['git', 'config', 'rietveld.server'],), ''), 1476 ((['git', 'config', 'rietveld.server'],), ''),
1477 ((['git', 'config', 'branch.feature.rietveldserver'],), 1477 ((['git', 'config', 'branch.feature.rietveldserver'],),
1478 'https://codereview.chromium.org'), 1478 'https://codereview.chromium.org'),
1479 ((['SetFlag', 'commit', '1'], ), ''), 1479 ((['SetFlags', {'commit': '1', 'cq_dry_run': '0'}], ), ''),
1480 ] 1480 ]
1481 self.assertEqual(0, git_cl.main(['set-commit'])) 1481 self.assertEqual(0, git_cl.main(['set-commit']))
1482 1482
1483 def _cmd_set_commit_gerrit_common(self, vote): 1483 def _cmd_set_commit_gerrit_common(self, vote):
1484 self.mock(git_cl.gerrit_util, 'SetReview', 1484 self.mock(git_cl.gerrit_util, 'SetReview',
1485 lambda h, i, labels: self._mocked_call( 1485 lambda h, i, labels: self._mocked_call(
1486 ['SetReview', h, i, labels])) 1486 ['SetReview', h, i, labels]))
1487 self.calls = [ 1487 self.calls = [
1488 ((['git', 'symbolic-ref', 'HEAD'],), 'feature'), 1488 ((['git', 'symbolic-ref', 'HEAD'],), 'feature'),
1489 ((['git', 'config', 'branch.feature.rietveldissue'],), ''), 1489 ((['git', 'config', 'branch.feature.rietveldissue'],), ''),
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1748 ((['rm_file_or_tree', '/abs/git_repo_root/.git/hooks/commit-msg'],), 1748 ((['rm_file_or_tree', '/abs/git_repo_root/.git/hooks/commit-msg'],),
1749 ''), 1749 ''),
1750 ] 1750 ]
1751 cl._codereview_impl._GerritCommitMsgHookCheck(offer_removal=True) 1751 cl._codereview_impl._GerritCommitMsgHookCheck(offer_removal=True)
1752 1752
1753 1753
1754 if __name__ == '__main__': 1754 if __name__ == '__main__':
1755 git_cl.logging.basicConfig( 1755 git_cl.logging.basicConfig(
1756 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) 1756 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR)
1757 unittest.main() 1757 unittest.main()
OLDNEW
« 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