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

Side by Side Diff: tests/git_cl_test.py

Issue 1095033002: Enable OAuth2 by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: fix smoke tests Created 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/basic.sh ('k') | tests/owners.sh » ('j') | 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 self.mock(git_cl, 'FindCodereviewSettingsFile', lambda: '') 89 self.mock(git_cl, 'FindCodereviewSettingsFile', lambda: '')
90 self.mock(git_cl, 'ask_for_data', self._mocked_call) 90 self.mock(git_cl, 'ask_for_data', self._mocked_call)
91 self.mock(git_cl.breakpad, 'post', self._mocked_call) 91 self.mock(git_cl.breakpad, 'post', self._mocked_call)
92 self.mock(git_cl.breakpad, 'SendStack', self._mocked_call) 92 self.mock(git_cl.breakpad, 'SendStack', self._mocked_call)
93 self.mock(git_cl.presubmit_support, 'DoPresubmitChecks', PresubmitMock) 93 self.mock(git_cl.presubmit_support, 'DoPresubmitChecks', PresubmitMock)
94 self.mock(git_cl.rietveld, 'Rietveld', RietveldMock) 94 self.mock(git_cl.rietveld, 'Rietveld', RietveldMock)
95 self.mock(git_cl.rietveld, 'CachingRietveld', RietveldMock) 95 self.mock(git_cl.rietveld, 'CachingRietveld', RietveldMock)
96 self.mock(git_cl.upload, 'RealMain', self.fail) 96 self.mock(git_cl.upload, 'RealMain', self.fail)
97 self.mock(git_cl.watchlists, 'Watchlists', WatchlistsMock) 97 self.mock(git_cl.watchlists, 'Watchlists', WatchlistsMock)
98 self.mock(git_cl.auth, 'get_authenticator_for_host', AuthenticatorMock) 98 self.mock(git_cl.auth, 'get_authenticator_for_host', AuthenticatorMock)
99 self.mock(git_cl.auth, '_should_use_oauth2', lambda: False)
100 # It's important to reset settings to not have inter-tests interference. 99 # It's important to reset settings to not have inter-tests interference.
101 git_cl.settings = None 100 git_cl.settings = None
102 101
103 def tearDown(self): 102 def tearDown(self):
104 if not self.has_failed(): 103 if not self.has_failed():
105 self.assertEquals([], self.calls) 104 self.assertEquals([], self.calls)
106 super(TestGitCl, self).tearDown() 105 super(TestGitCl, self).tearDown()
107 106
108 def _mocked_call(self, *args, **_kwargs): 107 def _mocked_call(self, *args, **_kwargs):
109 self.assertTrue( 108 self.assertTrue(
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 ((['git', 'symbolic-ref', 'HEAD'],), 'master'), 163 ((['git', 'symbolic-ref', 'HEAD'],), 'master'),
165 similarity_call, 164 similarity_call,
166 ((['git', 'symbolic-ref', 'HEAD'],), 'master'), 165 ((['git', 'symbolic-ref', 'HEAD'],), 'master'),
167 find_copies_call, 166 find_copies_call,
168 ((['git', 'symbolic-ref', 'HEAD'],), 'master'), 167 ((['git', 'symbolic-ref', 'HEAD'],), 'master'),
169 ((['git', 'config', 'branch.master.merge'],), 'master'), 168 ((['git', 'config', 'branch.master.merge'],), 'master'),
170 ((['git', 'config', 'branch.master.remote'],), 'origin'), 169 ((['git', 'config', 'branch.master.remote'],), 'origin'),
171 ((['get_or_create_merge_base', 'master', 'master'],), 170 ((['get_or_create_merge_base', 'master', 'master'],),
172 'fake_ancestor_sha'), 171 'fake_ancestor_sha'),
173 ((['git', 'config', 'gerrit.host'],), ''), 172 ((['git', 'config', 'gerrit.host'],), ''),
173 ((['git', 'config', 'branch.master.rietveldissue'],), ''),
174 ] + cls._git_sanity_checks('fake_ancestor_sha', 'master') + [ 174 ] + cls._git_sanity_checks('fake_ancestor_sha', 'master') + [
175 ((['git', 'rev-parse', '--show-cdup'],), ''), 175 ((['git', 'rev-parse', '--show-cdup'],), ''),
176 ((['git', 'rev-parse', 'HEAD'],), '12345'), 176 ((['git', 'rev-parse', 'HEAD'],), '12345'),
177 ((['git', 'diff', '--name-status', '--no-renames', '-r', 177 ((['git', 'diff', '--name-status', '--no-renames', '-r',
178 'fake_ancestor_sha...', '.'],), 178 'fake_ancestor_sha...', '.'],),
179 'M\t.gitignore\n'), 179 'M\t.gitignore\n'),
180 ((['git', 'config', 'branch.master.rietveldissue'],), ''),
181 ((['git', 'config', 'branch.master.rietveldpatchset'],), 180 ((['git', 'config', 'branch.master.rietveldpatchset'],),
182 ''), 181 ''),
183 ((['git', 'log', '--pretty=format:%s%n%n%b', 182 ((['git', 'log', '--pretty=format:%s%n%n%b',
184 'fake_ancestor_sha...'],), 183 'fake_ancestor_sha...'],),
185 'foo'), 184 'foo'),
186 ((['git', 'config', 'user.email'],), 'me@example.com'), 185 ((['git', 'config', 'user.email'],), 'me@example.com'),
187 stat_call, 186 stat_call,
188 ((['git', 'log', '--pretty=format:%s\n\n%b', 187 ((['git', 'log', '--pretty=format:%s\n\n%b',
189 'fake_ancestor_sha..HEAD'],), 188 'fake_ancestor_sha..HEAD'],),
190 'desc\n'), 189 'desc\n'),
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 # Check target refs for pending prefix. 850 # Check target refs for pending prefix.
852 self.assertEqual('prefix/heads/master', 851 self.assertEqual('prefix/heads/master',
853 git_cl.GetTargetRef('origin', 'refs/remotes/origin/master', 852 git_cl.GetTargetRef('origin', 'refs/remotes/origin/master',
854 None, 'prefix/')) 853 None, 'prefix/'))
855 854
856 855
857 if __name__ == '__main__': 856 if __name__ == '__main__':
858 git_cl.logging.basicConfig( 857 git_cl.logging.basicConfig(
859 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) 858 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR)
860 unittest.main() 859 unittest.main()
OLDNEW
« no previous file with comments | « tests/basic.sh ('k') | tests/owners.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698