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 sys | 10 import sys |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 'Issue: 12345\n\nReview URL: https://codereview.example.com/12345'],), | 194 'Issue: 12345\n\nReview URL: https://codereview.example.com/12345'],), |
195 ''), | 195 ''), |
196 ((['git', 'svn', 'dcommit', '--no-rebase', '--rmdir'],), (('', None), 0)), | 196 ((['git', 'svn', 'dcommit', '--no-rebase', '--rmdir'],), (('', None), 0)), |
197 ((['git', 'checkout', '-q', 'working'],), ''), | 197 ((['git', 'checkout', '-q', 'working'],), ''), |
198 ((['git', 'branch', '-D', 'git-cl-commit'],), ''), | 198 ((['git', 'branch', '-D', 'git-cl-commit'],), ''), |
199 ] | 199 ] |
200 | 200 |
201 @staticmethod | 201 @staticmethod |
202 def _cmd_line(description, args): | 202 def _cmd_line(description, args): |
203 """Returns the upload command line passed to upload.RealMain().""" | 203 """Returns the upload command line passed to upload.RealMain().""" |
204 msg = description.split('\n', 1)[0] | |
205 return [ | 204 return [ |
206 'upload', '--assume_yes', '--server', | 205 'upload', '--assume_yes', '--server', |
207 'https://codereview.example.com', | 206 'https://codereview.example.com', |
208 '--message', msg, | 207 '--message', description |
209 '--description', description | |
210 ] + args + [ | 208 ] + args + [ |
211 '--cc', 'joe@example.com', | 209 '--cc', 'joe@example.com', |
212 'master...' | 210 'master...' |
213 ] | 211 ] |
214 | 212 |
215 def _run_reviewer_test( | 213 def _run_reviewer_test( |
216 self, | 214 self, |
217 upload_args, | 215 upload_args, |
218 expected_description, | 216 expected_description, |
219 returned_description, | 217 returned_description, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 def test_dcommit_bypass_hooks(self): | 314 def test_dcommit_bypass_hooks(self): |
317 self.calls = ( | 315 self.calls = ( |
318 self._dcommit_calls_1() + | 316 self._dcommit_calls_1() + |
319 self._dcommit_calls_bypassed() + | 317 self._dcommit_calls_bypassed() + |
320 self._dcommit_calls_3()) | 318 self._dcommit_calls_3()) |
321 git_cl.main(['dcommit', '--bypass-hooks']) | 319 git_cl.main(['dcommit', '--bypass-hooks']) |
322 | 320 |
323 | 321 |
324 if __name__ == '__main__': | 322 if __name__ == '__main__': |
325 unittest.main() | 323 unittest.main() |
OLD | NEW |