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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 else: | 378 else: |
379 find_copies = None | 379 find_copies = None |
380 | 380 |
381 private = '--private' in upload_args | 381 private = '--private' in upload_args |
382 | 382 |
383 self.calls = self._upload_calls(similarity, find_copies, private) | 383 self.calls = self._upload_calls(similarity, find_copies, private) |
384 def RunEditor(desc, _, **kwargs): | 384 def RunEditor(desc, _, **kwargs): |
385 self.assertEquals( | 385 self.assertEquals( |
386 '# Enter a description of the change.\n' | 386 '# Enter a description of the change.\n' |
387 '# This will be displayed on the codereview site.\n' | 387 '# This will be displayed on the codereview site.\n' |
388 '# The first line will also be used as the subject of the review.\n' + | 388 '# The first line will also be used as the subject of the review.\n' |
| 389 '#----------------------This line is 76 characters long' |
| 390 '----------------------\n' + |
389 expected_description, | 391 expected_description, |
390 desc) | 392 desc) |
391 return returned_description | 393 return returned_description |
392 self.mock(git_cl.gclient_utils, 'RunEditor', RunEditor) | 394 self.mock(git_cl.gclient_utils, 'RunEditor', RunEditor) |
393 def check_upload(args): | 395 def check_upload(args): |
394 cmd_line = self._cmd_line(final_description, reviewers, similarity, | 396 cmd_line = self._cmd_line(final_description, reviewers, similarity, |
395 find_copies, private) | 397 find_copies, private) |
396 self.assertEquals(cmd_line, args) | 398 self.assertEquals(cmd_line, args) |
397 return 1, 2 | 399 return 1, 2 |
398 self.mock(git_cl.upload, 'RealMain', check_upload) | 400 self.mock(git_cl.upload, 'RealMain', check_upload) |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 obj = git_cl.ChangeDescription(orig) | 711 obj = git_cl.ChangeDescription(orig) |
710 obj.update_reviewers(reviewers) | 712 obj.update_reviewers(reviewers) |
711 actual.append(obj.description) | 713 actual.append(obj.description) |
712 self.assertEqual(expected, actual) | 714 self.assertEqual(expected, actual) |
713 | 715 |
714 | 716 |
715 if __name__ == '__main__': | 717 if __name__ == '__main__': |
716 git_cl.logging.basicConfig( | 718 git_cl.logging.basicConfig( |
717 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) | 719 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) |
718 unittest.main() | 720 unittest.main() |
OLD | NEW |