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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 ((['git', 'config', 'gerrit.host'],), ''), | 164 ((['git', 'config', 'gerrit.host'],), ''), |
165 ((['git', 'log', '--pretty=format:%s\n\n%b', 'fake_ancestor_sha..HEAD'],), | 165 ((['git', 'log', '--pretty=format:%s\n\n%b', 'fake_ancestor_sha..HEAD'],), |
166 'desc\n'), | 166 'desc\n'), |
167 ] | 167 ] |
168 | 168 |
169 @classmethod | 169 @classmethod |
170 def _git_upload_calls(cls): | 170 def _git_upload_calls(cls): |
171 return [ | 171 return [ |
172 ((['git', 'config', 'rietveld.cc'],), ''), | 172 ((['git', 'config', 'rietveld.cc'],), ''), |
173 ((['git', 'config', 'branch.master.base-url'],), ''), | 173 ((['git', 'config', 'branch.master.base-url'],), ''), |
174 ((['git', 'config', '--get-regexp', '^svn-remote\\.'],), | 174 ((['git', 'config', '--local', '--get-regexp', '^svn-remote\\.'],), |
175 (('', None), 0)), | 175 (('', None), 0)), |
176 ((['git', 'rev-parse', '--show-cdup'],), ''), | 176 ((['git', 'rev-parse', '--show-cdup'],), ''), |
177 ((['git', 'svn', 'info'],), ''), | 177 ((['git', 'svn', 'info'],), ''), |
178 ((['git', 'config', 'branch.master.rietveldissue', '1'],), ''), | 178 ((['git', 'config', 'branch.master.rietveldissue', '1'],), ''), |
179 ((['git', 'config', 'branch.master.rietveldserver', | 179 ((['git', 'config', 'branch.master.rietveldserver', |
180 'https://codereview.example.com'],), ''), | 180 'https://codereview.example.com'],), ''), |
181 ((['git', 'config', 'branch.master.rietveldpatchset', '2'],), ''), | 181 ((['git', 'config', 'branch.master.rietveldpatchset', '2'],), ''), |
182 ((['git', 'rev-parse', 'HEAD'],), 'hash'), | 182 ((['git', 'rev-parse', 'HEAD'],), 'hash'), |
183 ((['git', 'symbolic-ref', 'HEAD'],), 'hash'), | 183 ((['git', 'symbolic-ref', 'HEAD'],), 'hash'), |
184 ((['git', 'config', 'branch.hash.last-upload-hash', 'hash'],), ''), | 184 ((['git', 'config', 'branch.hash.last-upload-hash', 'hash'],), ''), |
(...skipping 14 matching lines...) Expand all Loading... |
199 ((['git', 'config', 'branch.%s.merge' % working_branch],), | 199 ((['git', 'config', 'branch.%s.merge' % working_branch],), |
200 'refs/heads/master'), | 200 'refs/heads/master'), |
201 ((['git', 'config', 'branch.%s.remote' % working_branch],), 'origin'), | 201 ((['git', 'config', 'branch.%s.remote' % working_branch],), 'origin'), |
202 ((['git', 'rev-list', '^' + fake_ancestor, | 202 ((['git', 'rev-list', '^' + fake_ancestor, |
203 'refs/remotes/origin/master'],), ''), | 203 'refs/remotes/origin/master'],), ''), |
204 ] | 204 ] |
205 | 205 |
206 @classmethod | 206 @classmethod |
207 def _dcommit_calls_1(cls): | 207 def _dcommit_calls_1(cls): |
208 return [ | 208 return [ |
209 ((['git', 'config', '--get-regexp', '^svn-remote\\.'],), | 209 ((['git', 'config', '--local', '--get-regexp', '^svn-remote\\.'],), |
210 ((('svn-remote.svn.url svn://svn.chromium.org/chrome\n' | 210 ((('svn-remote.svn.url svn://svn.chromium.org/chrome\n' |
211 'svn-remote.svn.fetch trunk/src:refs/remotes/origin/master'), | 211 'svn-remote.svn.fetch trunk/src:refs/remotes/origin/master'), |
212 None), | 212 None), |
213 0)), | 213 0)), |
214 ((['git', 'config', 'rietveld.server'],), 'codereview.example.com'), | 214 ((['git', 'config', 'rietveld.server'],), 'codereview.example.com'), |
215 ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'), | 215 ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'), |
216 ((['git', 'config', '--int', '--get', | 216 ((['git', 'config', '--int', '--get', |
217 'branch.working.git-cl-similarity'],), ''), | 217 'branch.working.git-cl-similarity'],), ''), |
218 ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'), | 218 ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'), |
219 ((['git', 'config', '--int', '--get', | 219 ((['git', 'config', '--int', '--get', |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 for orig, reviewers, expected in data: | 616 for orig, reviewers, expected in data: |
617 obj = git_cl.ChangeDescription(orig) | 617 obj = git_cl.ChangeDescription(orig) |
618 obj.update_reviewers(reviewers) | 618 obj.update_reviewers(reviewers) |
619 self.assertEqual(expected, obj.description) | 619 self.assertEqual(expected, obj.description) |
620 | 620 |
621 | 621 |
622 if __name__ == '__main__': | 622 if __name__ == '__main__': |
623 git_cl.logging.basicConfig( | 623 git_cl.logging.basicConfig( |
624 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) | 624 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) |
625 unittest.main() | 625 unittest.main() |
OLD | NEW |