| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 @staticmethod | 99 @staticmethod |
| 100 def _git_upload_calls(): | 100 def _git_upload_calls(): |
| 101 return [ | 101 return [ |
| 102 (['git', 'config', 'rietveld.cc'], ''), | 102 (['git', 'config', 'rietveld.cc'], ''), |
| 103 (['git', 'config', '--get-regexp', '^svn-remote\\.'], (('', None), 0)), | 103 (['git', 'config', '--get-regexp', '^svn-remote\\.'], (('', None), 0)), |
| 104 (['git', 'rev-parse', '--show-cdup'], ''), | 104 (['git', 'rev-parse', '--show-cdup'], ''), |
| 105 (['git', 'svn', 'info'], ''), | 105 (['git', 'svn', 'info'], ''), |
| 106 (['git', 'config', 'branch.master.rietveldissue', '1'], ''), | 106 (['git', 'config', 'branch.master.rietveldissue', '1'], ''), |
| 107 (['git', 'config', 'branch.master.rietveldserver', | 107 (['git', 'config', 'branch.master.rietveldserver', |
| 108 'http://codereview.example.com'], ''), | 108 'https://codereview.example.com'], ''), |
| 109 (['git', 'config', 'branch.master.rietveldpatchset', '2'], ''), | 109 (['git', 'config', 'branch.master.rietveldpatchset', '2'], ''), |
| 110 ] | 110 ] |
| 111 | 111 |
| 112 @staticmethod | 112 @staticmethod |
| 113 def _cmd_line(description, args): | 113 def _cmd_line(description, args): |
| 114 """Returns the upload command line passed to upload.RealMain().""" | 114 """Returns the upload command line passed to upload.RealMain().""" |
| 115 msg = description.split('\n', 1)[0] | 115 msg = description.split('\n', 1)[0] |
| 116 return [ | 116 return [ |
| 117 'upload', '--assume_yes', '--server', | 117 'upload', '--assume_yes', '--server', |
| 118 'http://codereview.example.com', | 118 'https://codereview.example.com', |
| 119 '--message', msg, | 119 '--message', msg, |
| 120 '--description', description | 120 '--description', description |
| 121 ] + args + [ | 121 ] + args + [ |
| 122 '--cc', 'joe@example.com', | 122 '--cc', 'joe@example.com', |
| 123 'master...' | 123 'master...' |
| 124 ] | 124 ] |
| 125 | 125 |
| 126 def _run_reviewer_test( | 126 def _run_reviewer_test( |
| 127 self, | 127 self, |
| 128 upload_args, | 128 upload_args, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 self.mock(sys, 'stderr', mock) | 213 self.mock(sys, 'stderr', mock) |
| 214 git_cl.main(['upload', '--send-mail']) | 214 git_cl.main(['upload', '--send-mail']) |
| 215 self.fail() | 215 self.fail() |
| 216 except SystemExit: | 216 except SystemExit: |
| 217 self.assertEquals( | 217 self.assertEquals( |
| 218 'Must specify reviewers to send email.\n', mock.buf.getvalue()) | 218 'Must specify reviewers to send email.\n', mock.buf.getvalue()) |
| 219 | 219 |
| 220 | 220 |
| 221 if __name__ == '__main__': | 221 if __name__ == '__main__': |
| 222 unittest.main() | 222 unittest.main() |
| OLD | NEW |