| 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 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 return 1, 2 | 796 return 1, 2 |
| 797 self.mock(git_cl.upload, 'RealMain', check_upload) | 797 self.mock(git_cl.upload, 'RealMain', check_upload) |
| 798 | 798 |
| 799 git_cl.main(['upload', '--bypass-hooks', '--auto-bots']) | 799 git_cl.main(['upload', '--bypass-hooks', '--auto-bots']) |
| 800 found = re.search("CQ_TRYBOTS=(.*?)$", stored_description[0]) | 800 found = re.search("CQ_TRYBOTS=(.*?)$", stored_description[0]) |
| 801 self.assertTrue(found) | 801 self.assertTrue(found) |
| 802 self.assertEqual(found.group(1), '%s:%s' % (TEST_MASTER, TEST_BUILDER)) | 802 self.assertEqual(found.group(1), '%s:%s' % (TEST_MASTER, TEST_BUILDER)) |
| 803 | 803 |
| 804 | 804 |
| 805 class ChangelistMock(object): | 805 class ChangelistMock(object): |
| 806 # Disable "Method could be a function" |
| 807 # pylint: disable=R0201 |
| 808 |
| 806 def __init__(self, change_mock): | 809 def __init__(self, change_mock): |
| 807 self.change_mock = change_mock | 810 self.change_mock = change_mock |
| 808 | 811 |
| 809 # Disable "Method could be a function" | |
| 810 # pylint: disable=R0201 | |
| 811 def GetChange(self, *args): | 812 def GetChange(self, *args): |
| 812 return self.change_mock | 813 return self.change_mock |
| 813 | 814 |
| 814 def GetIssue(self): | 815 def GetIssue(self): |
| 815 return None | 816 return None |
| 816 | 817 |
| 817 def GetBranch(self): | 818 def GetBranch(self): |
| 818 return [] | 819 return [] |
| 819 | 820 |
| 820 def GetCommonAncestorWithUpstream(self): | 821 def GetCommonAncestorWithUpstream(self): |
| (...skipping 15 matching lines...) Expand all Loading... |
| 836 pass | 837 pass |
| 837 | 838 |
| 838 def SetIssue(self, issue): | 839 def SetIssue(self, issue): |
| 839 pass | 840 pass |
| 840 | 841 |
| 841 def SetPatchset(self, issue): | 842 def SetPatchset(self, issue): |
| 842 pass | 843 pass |
| 843 | 844 |
| 844 | 845 |
| 845 class ChangeMock(object): | 846 class ChangeMock(object): |
| 847 # Disable "Method could be a function" |
| 848 # pylint: disable=R0201 |
| 849 |
| 846 def __init__(self): | 850 def __init__(self): |
| 847 self.stored_description = None | 851 self.stored_description = None |
| 848 | 852 |
| 849 # Disable "Method could be a function" | |
| 850 # pylint: disable=R0201 | |
| 851 def SetDescriptionText(self, desc): | 853 def SetDescriptionText(self, desc): |
| 852 self.stored_description = desc | 854 self.stored_description = desc |
| 853 | 855 |
| 854 def FullDescriptionText(self): | 856 def FullDescriptionText(self): |
| 855 return 'HIHI TEST DESCRIPTION' | 857 return 'HIHI TEST DESCRIPTION' |
| 856 | 858 |
| 857 def RepositoryRoot(self): | 859 def RepositoryRoot(self): |
| 858 return [] | 860 return [] |
| 859 | 861 |
| 860 def AffectedFiles(self): | 862 def AffectedFiles(self): |
| 861 return [] | 863 return [] |
| 862 | 864 |
| 863 def LocalPaths(self): | 865 def LocalPaths(self): |
| 864 return None | 866 return None |
| 865 | 867 |
| 866 if __name__ == '__main__': | 868 if __name__ == '__main__': |
| 867 git_cl.logging.basicConfig( | 869 git_cl.logging.basicConfig( |
| 868 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) | 870 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) |
| 869 unittest.main() | 871 unittest.main() |
| OLD | NEW |