| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 # If this test fails, you should add the relevant test. | 72 # If this test fails, you should add the relevant test. |
| 73 self.compareMembers(gcl, members) | 73 self.compareMembers(gcl, members) |
| 74 | 74 |
| 75 | 75 |
| 76 def testHelp(self): | 76 def testHelp(self): |
| 77 old_stdout = sys.stdout | 77 old_stdout = sys.stdout |
| 78 try: | 78 try: |
| 79 dummy = StringIO.StringIO() | 79 dummy = StringIO.StringIO() |
| 80 gcl.sys.stdout = dummy | 80 gcl.sys.stdout = dummy |
| 81 gcl.Help() | 81 gcl.Help() |
| 82 self.assertEquals(len(dummy.getvalue()), 1815) | 82 self.assertEquals(len(dummy.getvalue()), 1832) |
| 83 finally: | 83 finally: |
| 84 gcl.sys.stdout = old_stdout | 84 gcl.sys.stdout = old_stdout |
| 85 | 85 |
| 86 def testGetRepositoryRootNone(self): | 86 def testGetRepositoryRootNone(self): |
| 87 gcl.REPOSITORY_ROOT = None | 87 gcl.REPOSITORY_ROOT = None |
| 88 gcl.os.getcwd().AndReturn("/bleh/prout") | 88 gcl.os.getcwd().AndReturn("/bleh/prout") |
| 89 result = { | 89 result = { |
| 90 "Repository Root": "" | 90 "Repository Root": "" |
| 91 } | 91 } |
| 92 gcl.gclient.CaptureSVNInfo("/bleh/prout", print_error=False).AndReturn( | 92 gcl.gclient.CaptureSVNInfo("/bleh/prout", print_error=False).AndReturn( |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 ['--issue', '1', '--patchset', '2'], | 278 ['--issue', '1', '--patchset', '2'], |
| 279 swallow_exception=True) | 279 swallow_exception=True) |
| 280 gcl.os.chdir('somewhere') | 280 gcl.os.chdir('somewhere') |
| 281 self.mox.ReplayAll() | 281 self.mox.ReplayAll() |
| 282 gcl.UploadCL(change_info, args) | 282 gcl.UploadCL(change_info, args) |
| 283 self.mox.VerifyAll() | 283 self.mox.VerifyAll() |
| 284 | 284 |
| 285 | 285 |
| 286 if __name__ == '__main__': | 286 if __name__ == '__main__': |
| 287 unittest.main() | 287 unittest.main() |
| OLD | NEW |