OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 StringIO | 6 import StringIO |
7 | 7 |
8 # Fixes include path. | 8 # Fixes include path. |
9 from super_mox import SuperMoxTestBase | 9 from super_mox import SuperMoxTestBase |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 stderr=None, | 58 stderr=None, |
59 stdout=gclient_utils.subprocess.PIPE).AndReturn(process) | 59 stdout=gclient_utils.subprocess.PIPE).AndReturn(process) |
60 process.communicate().AndReturn(['bleh', 'foo']) | 60 process.communicate().AndReturn(['bleh', 'foo']) |
61 self.mox.ReplayAll() | 61 self.mox.ReplayAll() |
62 try: | 62 try: |
63 gclient_utils.CheckCall(args) | 63 gclient_utils.CheckCall(args) |
64 self.fail() | 64 self.fail() |
65 except gclient_utils.CheckCallError, e: | 65 except gclient_utils.CheckCallError, e: |
66 self.assertEqual(e.command, args) | 66 self.assertEqual(e.command, args) |
67 self.assertEqual(e.cwd, None) | 67 self.assertEqual(e.cwd, None) |
68 self.assertEqual(e.retcode, 42) | 68 self.assertEqual(e.returncode, 42) |
69 self.assertEqual(e.stdout, 'bleh') | 69 self.assertEqual(e.stdout, 'bleh') |
70 self.assertEqual(e.stderr, 'foo') | 70 self.assertEqual(e.stderr, 'foo') |
71 | 71 |
72 | 72 |
73 class CheckCallAndFilterTestCase(GclientUtilBase): | 73 class CheckCallAndFilterTestCase(GclientUtilBase): |
74 class ProcessIdMock(object): | 74 class ProcessIdMock(object): |
75 def __init__(self, test_string): | 75 def __init__(self, test_string): |
76 self.stdout = StringIO.StringIO(test_string) | 76 self.stdout = StringIO.StringIO(test_string) |
77 def wait(self): | 77 def wait(self): |
78 pass | 78 pass |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 out_url, out_rev = gclient_utils.SplitUrlRevision("%s@%s" % (url, rev)) | 155 out_url, out_rev = gclient_utils.SplitUrlRevision("%s@%s" % (url, rev)) |
156 self.assertEquals(out_rev, rev) | 156 self.assertEquals(out_rev, rev) |
157 self.assertEquals(out_url, url) | 157 self.assertEquals(out_url, url) |
158 | 158 |
159 | 159 |
160 if __name__ == '__main__': | 160 if __name__ == '__main__': |
161 import unittest | 161 import unittest |
162 unittest.main() | 162 unittest.main() |
163 | 163 |
164 # vim: ts=2:sw=2:tw=80:et: | 164 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |