| 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 find_copies = True | 324 find_copies = True |
| 325 elif '--no-find-copies' in upload_args: | 325 elif '--no-find-copies' in upload_args: |
| 326 find_copies = False | 326 find_copies = False |
| 327 else: | 327 else: |
| 328 find_copies = None | 328 find_copies = None |
| 329 | 329 |
| 330 self.calls = self._upload_calls(similarity, find_copies) | 330 self.calls = self._upload_calls(similarity, find_copies) |
| 331 def RunEditor(desc, _): | 331 def RunEditor(desc, _): |
| 332 self.assertEquals( | 332 self.assertEquals( |
| 333 '# Enter a description of the change.\n' | 333 '# Enter a description of the change.\n' |
| 334 '# This will displayed on the codereview site.\n' | 334 '# This will be displayed on the codereview site.\n' |
| 335 '# The first line will also be used as the subject of the review.\n' + | 335 '# The first line will also be used as the subject of the review.\n' + |
| 336 expected_description, | 336 expected_description, |
| 337 desc) | 337 desc) |
| 338 return returned_description | 338 return returned_description |
| 339 self.mock(git_cl.gclient_utils, 'RunEditor', RunEditor) | 339 self.mock(git_cl.gclient_utils, 'RunEditor', RunEditor) |
| 340 def check_upload(args): | 340 def check_upload(args): |
| 341 cmd_line = self._cmd_line(final_description, reviewers, similarity, | 341 cmd_line = self._cmd_line(final_description, reviewers, similarity, |
| 342 find_copies) | 342 find_copies) |
| 343 self.assertEquals(cmd_line, args) | 343 self.assertEquals(cmd_line, args) |
| 344 return 1, 2 | 344 return 1, 2 |
| (...skipping 271 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 |