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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 self.mock(git_cl.sys, 'stdout', StringIO.StringIO()) | 673 self.mock(git_cl.sys, 'stdout', StringIO.StringIO()) |
674 self.calls = ( | 674 self.calls = ( |
675 self._dcommit_calls_1() + | 675 self._dcommit_calls_1() + |
676 self._dcommit_calls_bypassed() + | 676 self._dcommit_calls_bypassed() + |
677 self._dcommit_calls_3()) | 677 self._dcommit_calls_3()) |
678 git_cl.main(['dcommit', '--bypass-hooks']) | 678 git_cl.main(['dcommit', '--bypass-hooks']) |
679 | 679 |
680 | 680 |
681 @classmethod | 681 @classmethod |
682 def _gerrit_ensure_auth_calls(cls, issue=None, skip_auth_check=False): | 682 def _gerrit_ensure_auth_calls(cls, issue=None, skip_auth_check=False): |
683 cmd = ['git', 'config', '--bool', 'gerrit.skip_ensure_authenticated'] | 683 cmd = ['git', 'config', '--bool', 'gerrit.skip-ensure-authenticated'] |
684 if skip_auth_check: | 684 if skip_auth_check: |
685 return [((cmd, ), 'true')] | 685 return [((cmd, ), 'true')] |
686 | 686 |
687 calls = [((cmd, ), '', subprocess2.CalledProcessError(1, '', '', '', ''))] | 687 calls = [((cmd, ), '', subprocess2.CalledProcessError(1, '', '', '', ''))] |
688 if issue: | 688 if issue: |
689 calls.extend([ | 689 calls.extend([ |
690 ((['git', 'config', 'branch.master.gerritserver'],), ''), | 690 ((['git', 'config', 'branch.master.gerritserver'],), ''), |
691 ]) | 691 ]) |
692 calls.extend([ | 692 calls.extend([ |
693 ((['git', 'config', 'branch.master.merge'],), 'refs/heads/master'), | 693 ((['git', 'config', 'branch.master.merge'],), 'refs/heads/master'), |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1375 # TODO(tandrii): consider testing just set-commit and set-commit --clear, | 1375 # TODO(tandrii): consider testing just set-commit and set-commit --clear, |
1376 # but without copy-pasting tons of expectations, as modifying them later is | 1376 # but without copy-pasting tons of expectations, as modifying them later is |
1377 # super tedious. | 1377 # super tedious. |
1378 self.assertEqual(0, git_cl.main(['set-commit', '-d'])) | 1378 self.assertEqual(0, git_cl.main(['set-commit', '-d'])) |
1379 | 1379 |
1380 | 1380 |
1381 if __name__ == '__main__': | 1381 if __name__ == '__main__': |
1382 git_cl.logging.basicConfig( | 1382 git_cl.logging.basicConfig( |
1383 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) | 1383 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) |
1384 unittest.main() | 1384 unittest.main() |
OLD | NEW |