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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 'Issue: 12345\n\nReview URL: https://codereview.example.com/12345'],), | 192 'Issue: 12345\n\nReview URL: https://codereview.example.com/12345'],), |
193 ''), | 193 ''), |
194 ((['git', 'svn', 'dcommit', '--no-rebase', '--rmdir'],), (('', None), 0)), | 194 ((['git', 'svn', 'dcommit', '--no-rebase', '--rmdir'],), (('', None), 0)), |
195 ((['git', 'checkout', '-q', 'working'],), ''), | 195 ((['git', 'checkout', '-q', 'working'],), ''), |
196 ((['git', 'branch', '-D', 'git-cl-commit'],), ''), | 196 ((['git', 'branch', '-D', 'git-cl-commit'],), ''), |
197 ] | 197 ] |
198 | 198 |
199 @staticmethod | 199 @staticmethod |
200 def _cmd_line(description, args): | 200 def _cmd_line(description, args): |
201 """Returns the upload command line passed to upload.RealMain().""" | 201 """Returns the upload command line passed to upload.RealMain().""" |
202 msg = description.split('\n', 1)[0] | |
203 return [ | 202 return [ |
204 'upload', '--assume_yes', '--server', | 203 'upload', '--assume_yes', '--server', |
205 'https://codereview.example.com', | 204 'https://codereview.example.com', |
206 '--message', msg, | 205 '--message', description |
207 '--description', description | |
208 ] + args + [ | 206 ] + args + [ |
209 '--cc', 'joe@example.com', | 207 '--cc', 'joe@example.com', |
210 'master...' | 208 'master...' |
211 ] | 209 ] |
212 | 210 |
213 def _run_reviewer_test( | 211 def _run_reviewer_test( |
214 self, | 212 self, |
215 upload_args, | 213 upload_args, |
216 expected_description, | 214 expected_description, |
217 returned_description, | 215 returned_description, |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 382 |
385 def test_gerrit_reviewer_multiple(self): | 383 def test_gerrit_reviewer_multiple(self): |
386 self._run_gerrit_reviewer_test( | 384 self._run_gerrit_reviewer_test( |
387 [], | 385 [], |
388 'desc\nTBR=reviewer@example.com\nBUG=\nR=another@example.com\n', | 386 'desc\nTBR=reviewer@example.com\nBUG=\nR=another@example.com\n', |
389 ['reviewer@example.com', 'another@example.com']) | 387 ['reviewer@example.com', 'another@example.com']) |
390 | 388 |
391 | 389 |
392 if __name__ == '__main__': | 390 if __name__ == '__main__': |
393 unittest.main() | 391 unittest.main() |
OLD | NEW |