| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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() |
| OLD | NEW |