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

Side by Side Diff: tests/git_cl_test.py

Issue 1656373002: Remove reference to unused GERRIT_PORT from git_cl_test.py (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 def GetWatchersForPaths(_): 55 def GetWatchersForPaths(_):
56 return ['joe@example.com'] 56 return ['joe@example.com']
57 57
58 58
59 class CodereviewSettingsFileMock(object): 59 class CodereviewSettingsFileMock(object):
60 def __init__(self): 60 def __init__(self):
61 pass 61 pass
62 # pylint: disable=R0201 62 # pylint: disable=R0201
63 def read(self): 63 def read(self):
64 return ("CODE_REVIEW_SERVER: gerrit.chromium.org\n" + 64 return ("CODE_REVIEW_SERVER: gerrit.chromium.org\n" +
65 "GERRIT_HOST: gerrit.chromium.org\n" + 65 "GERRIT_HOST: True\n")
66 "GERRIT_PORT: 29418\n")
67 66
68 67
69 class AuthenticatorMock(object): 68 class AuthenticatorMock(object):
70 def __init__(self, *_args): 69 def __init__(self, *_args):
71 pass 70 pass
72 def has_cached_credentials(self): 71 def has_cached_credentials(self):
73 return True 72 return True
74 73
75 74
76 class TestGitCl(TestCase): 75 class TestGitCl(TestCase):
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 ((['git', 'config', '--int', '--get', 552 ((['git', 'config', '--int', '--get',
554 'branch.master.git-cl-similarity'],), ''), 553 'branch.master.git-cl-similarity'],), ''),
555 ((['git', 'symbolic-ref', 'HEAD'],), 'master'), 554 ((['git', 'symbolic-ref', 'HEAD'],), 'master'),
556 ((['git', 'config', '--int', '--get', 555 ((['git', 'config', '--int', '--get',
557 'branch.master.git-find-copies'],), ''), 556 'branch.master.git-find-copies'],), ''),
558 ((['git', 'symbolic-ref', 'HEAD'],), 'master'), 557 ((['git', 'symbolic-ref', 'HEAD'],), 'master'),
559 ((['git', 'config', 'branch.master.merge'],), 'master'), 558 ((['git', 'config', 'branch.master.merge'],), 'master'),
560 ((['git', 'config', 'branch.master.remote'],), 'origin'), 559 ((['git', 'config', 'branch.master.remote'],), 'origin'),
561 ((['get_or_create_merge_base', 'master', 'master'],), 560 ((['get_or_create_merge_base', 'master', 'master'],),
562 'fake_ancestor_sha'), 561 'fake_ancestor_sha'),
563 ((['git', 'config', 'gerrit.host'],), 'gerrit.example.com'), 562 ((['git', 'config', 'gerrit.host'],), 'True'),
564 ] + cls._git_sanity_checks('fake_ancestor_sha', 'master') + [ 563 ] + cls._git_sanity_checks('fake_ancestor_sha', 'master') + [
565 ((['git', 'rev-parse', '--show-cdup'],), ''), 564 ((['git', 'rev-parse', '--show-cdup'],), ''),
566 ((['git', 'rev-parse', 'HEAD'],), '12345'), 565 ((['git', 'rev-parse', 'HEAD'],), '12345'),
567 ((['git', 566 ((['git',
568 'diff', '--name-status', '--no-renames', '-r', 567 'diff', '--name-status', '--no-renames', '-r',
569 'fake_ancestor_sha...', '.'],), 568 'fake_ancestor_sha...', '.'],),
570 'M\t.gitignore\n'), 569 'M\t.gitignore\n'),
571 ((['git', 'config', 'branch.master.rietveldissue'],), ''), 570 ((['git', 'config', 'branch.master.rietveldissue'],), ''),
572 ((['git', 571 ((['git',
573 'config', 'branch.master.rietveldpatchset'],), ''), 572 'config', 'branch.master.rietveldpatchset'],), ''),
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 ret = git_cl.upload_branch_deps(MockChangelist(), []) 742 ret = git_cl.upload_branch_deps(MockChangelist(), [])
744 # CMDupload should have been called 5 times because of 5 dependent branches. 743 # CMDupload should have been called 5 times because of 5 dependent branches.
745 self.assertEquals(5, record_calls.times_called) 744 self.assertEquals(5, record_calls.times_called)
746 self.assertEquals(0, ret) 745 self.assertEquals(0, ret)
747 746
748 def test_config_gerrit_download_hook(self): 747 def test_config_gerrit_download_hook(self):
749 self.mock(git_cl, 'FindCodereviewSettingsFile', CodereviewSettingsFileMock) 748 self.mock(git_cl, 'FindCodereviewSettingsFile', CodereviewSettingsFileMock)
750 def ParseCodereviewSettingsContent(content): 749 def ParseCodereviewSettingsContent(content):
751 keyvals = {} 750 keyvals = {}
752 keyvals['CODE_REVIEW_SERVER'] = 'gerrit.chromium.org' 751 keyvals['CODE_REVIEW_SERVER'] = 'gerrit.chromium.org'
753 keyvals['GERRIT_HOST'] = 'gerrit.chromium.org' 752 keyvals['GERRIT_HOST'] = 'True'
754 keyvals['GERRIT_PORT'] = '29418'
755 return keyvals 753 return keyvals
756 self.mock(git_cl.gclient_utils, 'ParseCodereviewSettingsContent', 754 self.mock(git_cl.gclient_utils, 'ParseCodereviewSettingsContent',
757 ParseCodereviewSettingsContent) 755 ParseCodereviewSettingsContent)
758 self.mock(git_cl.os, 'access', self._mocked_call) 756 self.mock(git_cl.os, 'access', self._mocked_call)
759 self.mock(git_cl.os, 'chmod', self._mocked_call) 757 self.mock(git_cl.os, 'chmod', self._mocked_call)
760 src_dir = os.path.join(os.path.sep, 'usr', 'local', 'src') 758 src_dir = os.path.join(os.path.sep, 'usr', 'local', 'src')
761 def AbsPath(path): 759 def AbsPath(path):
762 if not path.startswith(os.path.sep): 760 if not path.startswith(os.path.sep):
763 return os.path.join(src_dir, path) 761 return os.path.join(src_dir, path)
764 return path 762 return path
(...skipping 26 matching lines...) Expand all
791 ((['git', 'config', '--unset-all', 789 ((['git', 'config', '--unset-all',
792 'rietveld.force-https-commit-url'],), ''), 790 'rietveld.force-https-commit-url'],), ''),
793 ((['git', 'config', '--unset-all', 791 ((['git', 'config', '--unset-all',
794 'rietveld.cpplint-ignore-regex'],), ''), 792 'rietveld.cpplint-ignore-regex'],), ''),
795 ((['git', 'config', '--unset-all', 793 ((['git', 'config', '--unset-all',
796 'rietveld.project'],), ''), 794 'rietveld.project'],), ''),
797 ((['git', 'config', '--unset-all', 795 ((['git', 'config', '--unset-all',
798 'rietveld.pending-ref-prefix'],), ''), 796 'rietveld.pending-ref-prefix'],), ''),
799 ((['git', 'config', '--unset-all', 797 ((['git', 'config', '--unset-all',
800 'rietveld.run-post-upload-hook'],), ''), 798 'rietveld.run-post-upload-hook'],), ''),
801 ((['git', 'config', 'gerrit.host', 799 ((['git', 'config', 'gerrit.host', 'True'],), ''),
802 'gerrit.chromium.org'],), ''),
803 # DownloadHooks(False) 800 # DownloadHooks(False)
804 ((['git', 'config', 'gerrit.host'],), 801 ((['git', 'config', 'gerrit.host'],), 'True'),
805 'gerrit.chromium.org'),
806 ((['git', 'rev-parse', '--show-cdup'],), ''), 802 ((['git', 'rev-parse', '--show-cdup'],), ''),
807 ((commit_msg_path, os.X_OK,), False), 803 ((commit_msg_path, os.X_OK,), False),
808 (('https://gerrit-review.googlesource.com/tools/hooks/commit-msg', 804 (('https://gerrit-review.googlesource.com/tools/hooks/commit-msg',
809 commit_msg_path,), ''), 805 commit_msg_path,), ''),
810 ((commit_msg_path,), True), 806 ((commit_msg_path,), True),
811 ((commit_msg_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR,), ''), 807 ((commit_msg_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR,), ''),
812 # GetCodereviewSettingsInteractively 808 # GetCodereviewSettingsInteractively
813 ((['git', 'config', 'rietveld.server'],), 809 ((['git', 'config', 'rietveld.server'],),
814 'gerrit.chromium.org'), 810 'gerrit.chromium.org'),
815 (('Rietveld server (host[:port]) [https://gerrit.chromium.org]:',), 811 (('Rietveld server (host[:port]) [https://gerrit.chromium.org]:',),
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 self.calls += [ 952 self.calls += [
957 ((['git', 'apply', '--index', '-p0', '--3way'],), '', 953 ((['git', 'apply', '--index', '-p0', '--3way'],), '',
958 subprocess2.CalledProcessError(1, '', '', '', '')), 954 subprocess2.CalledProcessError(1, '', '', '', '')),
959 ] 955 ]
960 self.assertNotEqual(git_cl.main(['patch', '123456']), 0) 956 self.assertNotEqual(git_cl.main(['patch', '123456']), 0)
961 957
962 if __name__ == '__main__': 958 if __name__ == '__main__':
963 git_cl.logging.basicConfig( 959 git_cl.logging.basicConfig(
964 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) 960 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR)
965 unittest.main() 961 unittest.main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698