| OLD | NEW | 
|    1 #!/usr/bin/python |    1 #!/usr/bin/python | 
|    2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |    2 # Copyright (c) 2006-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 import re |    6 import re | 
|    7 import StringIO |    7 import StringIO | 
|    8  |    8  | 
|    9 import gclient_utils |    9 import gclient_utils | 
|   10 from super_mox import SuperMoxTestBase |   10 from super_mox import SuperMoxTestBase | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
|   22         'stat', 'subprocess', 'sys', 'time', 'xml', |   22         'stat', 'subprocess', 'sys', 'time', 'xml', | 
|   23     ] |   23     ] | 
|   24     # If this test fails, you should add the relevant test. |   24     # If this test fails, you should add the relevant test. | 
|   25     self.compareMembers(gclient_utils, members) |   25     self.compareMembers(gclient_utils, members) | 
|   26  |   26  | 
|   27  |   27  | 
|   28 class CheckCallTestCase(SuperMoxTestBase): |   28 class CheckCallTestCase(SuperMoxTestBase): | 
|   29   def testCheckCallSuccess(self): |   29   def testCheckCallSuccess(self): | 
|   30     command = ['boo', 'foo', 'bar'] |   30     command = ['boo', 'foo', 'bar'] | 
|   31     process = self.mox.CreateMockAnything() |   31     process = self.mox.CreateMockAnything() | 
|   32     process.retcode = 0 |   32     process.returncode = 0 | 
|   33     gclient_utils.subprocess.Popen( |   33     gclient_utils.subprocess.Popen( | 
|   34         command, cwd=None, |   34         command, cwd=None, | 
|   35         stdout=gclient_utils.subprocess.PIPE, |   35         stdout=gclient_utils.subprocess.PIPE, | 
|   36         shell=gclient_utils.sys.platform.startswith('win')).AndReturn(process) |   36         shell=gclient_utils.sys.platform.startswith('win')).AndReturn(process) | 
|   37     process.communicate().AndReturn(['bleh']) |   37     process.communicate().AndReturn(['bleh']) | 
|   38     self.mox.ReplayAll() |   38     self.mox.ReplayAll() | 
|   39     gclient_utils.CheckCall(command) |   39     gclient_utils.CheckCall(command) | 
|   40  |   40  | 
|   41   def testCheckCallFailure(self): |   41   def testCheckCallFailure(self): | 
|   42     command = ['boo', 'foo', 'bar'] |   42     command = ['boo', 'foo', 'bar'] | 
|   43     process = self.mox.CreateMockAnything() |   43     process = self.mox.CreateMockAnything() | 
|   44     process.retcode = 42 |   44     process.returncode = 42 | 
|   45     gclient_utils.subprocess.Popen( |   45     gclient_utils.subprocess.Popen( | 
|   46         command, cwd=None, |   46         command, cwd=None, | 
|   47         stdout=gclient_utils.subprocess.PIPE, |   47         stdout=gclient_utils.subprocess.PIPE, | 
|   48         shell=gclient_utils.sys.platform.startswith('win')).AndReturn(process) |   48         shell=gclient_utils.sys.platform.startswith('win')).AndReturn(process) | 
|   49     process.communicate().AndReturn(['bleh']) |   49     process.communicate().AndReturn(['bleh']) | 
|   50     self.mox.ReplayAll() |   50     self.mox.ReplayAll() | 
|   51     try: |   51     try: | 
|   52       gclient_utils.CheckCall(command) |   52       gclient_utils.CheckCall(command) | 
|   53       self.fail() |   53       self.fail() | 
|   54     except gclient_utils.CheckCallError, e: |   54     except gclient_utils.CheckCallError, e: | 
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  145     base_url = 'svn://a/b/c/d' |  145     base_url = 'svn://a/b/c/d' | 
|  146     full_url = gclient_utils.FullUrlFromRelative2(base_url, '/crap') |  146     full_url = gclient_utils.FullUrlFromRelative2(base_url, '/crap') | 
|  147     self.assertEqual(full_url, 'svn://a/b/c/crap') |  147     self.assertEqual(full_url, 'svn://a/b/c/crap') | 
|  148  |  148  | 
|  149  |  149  | 
|  150 if __name__ == '__main__': |  150 if __name__ == '__main__': | 
|  151   import unittest |  151   import unittest | 
|  152   unittest.main() |  152   unittest.main() | 
|  153  |  153  | 
|  154 # vim: ts=2:sw=2:tw=80:et: |  154 # vim: ts=2:sw=2:tw=80:et: | 
| OLD | NEW |