| OLD | NEW | 
|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python | 
| 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2009 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 gcl.py.""" | 6 """Unit tests for gcl.py.""" | 
| 7 | 7 | 
| 8 import StringIO | 8 import StringIO | 
| 9 import os | 9 import os | 
| 10 import sys | 10 import sys | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 47       print diff | 47       print diff | 
| 48     self.assertEqual(actual_members, expected_members) | 48     self.assertEqual(actual_members, expected_members) | 
| 49 | 49 | 
| 50 | 50 | 
| 51 class GclUnittest(GclTestsBase): | 51 class GclUnittest(GclTestsBase): | 
| 52   """General gcl.py tests.""" | 52   """General gcl.py tests.""" | 
| 53   def testMembersChanged(self): | 53   def testMembersChanged(self): | 
| 54     members = [ | 54     members = [ | 
| 55       'CODEREVIEW_SETTINGS', 'CODEREVIEW_SETTINGS_FILE', 'CPP_EXTENSIONS', | 55       'CODEREVIEW_SETTINGS', 'CODEREVIEW_SETTINGS_FILE', 'CPP_EXTENSIONS', | 
| 56       'Change', 'ChangeInfo', 'Changes', 'Commit', 'DoPresubmitChecks', | 56       'Change', 'ChangeInfo', 'Changes', 'Commit', 'DoPresubmitChecks', | 
| 57       'ErrorExit', 'GenerateChangeName', 'GenerateDiff', 'GetCLs', | 57       'ErrorExit', 'GenerateChangeName', 'GenerateDiff', 'GetChangesDir', | 
|  | 58       'GetCLs', | 
| 58       'GetChangelistInfoFile', 'GetCodeReviewSetting', 'GetEditor', | 59       'GetChangelistInfoFile', 'GetCodeReviewSetting', 'GetEditor', | 
| 59       'GetFilesNotInCL', 'GetInfoDir', 'GetIssueDescription', | 60       'GetFilesNotInCL', 'GetInfoDir', 'GetIssueDescription', | 
| 60       'GetModifiedFiles', 'GetRepositoryRoot', | 61       'GetModifiedFiles', 'GetRepositoryRoot', | 
| 61       'GetSVNFileProperty', 'Help', 'IGNORE_PATHS', 'IsSVNMoved', 'IsTreeOpen', | 62       'GetSVNFileProperty', 'Help', 'IGNORE_PATHS', 'IsSVNMoved', 'IsTreeOpen', | 
| 62       'Lint', 'LoadChangelistInfo', 'LoadChangelistInfoForMultiple', | 63       'Lint', 'LoadChangelistInfo', 'LoadChangelistInfoForMultiple', | 
| 63       'MISSING_TEST_MSG', 'Opened', 'PresubmitCL', 'ReadFile', | 64       'MISSING_TEST_MSG', 'Opened', 'PresubmitCL', 'ReadFile', | 
| 64       'RunShell', | 65       'RunShell', | 
| 65       'RunShellWithReturnCode', 'SEPARATOR', 'SendToRietveld', 'TryChange', | 66       'RunShellWithReturnCode', 'SEPARATOR', 'SendToRietveld', 'TryChange', | 
| 66       'UnknownFiles', 'UploadCL', 'Warn', 'WriteFile', 'gclient', | 67       'UnknownFiles', 'UploadCL', 'Warn', 'WriteFile', | 
| 67       'gcl_info_dir', 'getpass', 'main', 'os', 'random', 're', 'read_gcl_info', | 68       'gclient', 'getpass', 'main', 'os', 'random', 're', 'read_gcl_info', | 
| 68       'repository_root', 'string', 'subprocess', 'sys', 'tempfile', 'upload', | 69       'repository_root', 'shutil', 'string', 'subprocess', 'sys', 'tempfile', | 
| 69       'urllib2', 'xml', | 70       'upload', 'urllib2', 'xml', | 
| 70     ] | 71     ] | 
| 71     # If this test fails, you should add the relevant test. | 72     # If this test fails, you should add the relevant test. | 
| 72     self.compareMembers(gcl, members) | 73     self.compareMembers(gcl, members) | 
| 73 | 74 | 
| 74 | 75 | 
| 75   def testHelp(self): | 76   def testHelp(self): | 
| 76     old_stdout = sys.stdout | 77     old_stdout = sys.stdout | 
| 77     try: | 78     try: | 
| 78       dummy = StringIO.StringIO() | 79       dummy = StringIO.StringIO() | 
| 79       gcl.sys.stdout = dummy | 80       gcl.sys.stdout = dummy | 
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 277                   ['--issue', '1', '--patchset', '2'], | 278                   ['--issue', '1', '--patchset', '2'], | 
| 278                   swallow_exception=True) | 279                   swallow_exception=True) | 
| 279     gcl.os.chdir('somewhere') | 280     gcl.os.chdir('somewhere') | 
| 280     self.mox.ReplayAll() | 281     self.mox.ReplayAll() | 
| 281     gcl.UploadCL(change_info, args) | 282     gcl.UploadCL(change_info, args) | 
| 282     self.mox.VerifyAll() | 283     self.mox.VerifyAll() | 
| 283 | 284 | 
| 284 | 285 | 
| 285 if __name__ == '__main__': | 286 if __name__ == '__main__': | 
| 286   unittest.main() | 287   unittest.main() | 
| OLD | NEW | 
|---|