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 |
11 import gclient_utils | 11 import gclient_utils |
12 | 12 |
13 | 13 |
14 class GclientUtilBase(SuperMoxTestBase): | 14 class GclientUtilBase(SuperMoxTestBase): |
15 def setUp(self): | 15 def setUp(self): |
16 super(GclientUtilBase, self).setUp() | 16 super(GclientUtilBase, self).setUp() |
17 gclient_utils.sys.stdout.flush = lambda: None | 17 gclient_utils.sys.stdout.flush = lambda: None |
18 self.mox.StubOutWithMock(gclient_utils, 'Popen') | 18 self.mox.StubOutWithMock(gclient_utils, 'Popen') |
19 | 19 |
20 | 20 |
21 class GclientUtilsUnittest(GclientUtilBase): | 21 class GclientUtilsUnittest(GclientUtilBase): |
22 """General gclient_utils.py tests.""" | 22 """General gclient_utils.py tests.""" |
23 def testMembersChanged(self): | 23 def testMembersChanged(self): |
24 members = [ | 24 members = [ |
25 'CheckCall', 'CheckCallError', 'CheckCallAndFilter', | 25 'CheckCall', 'CheckCallError', 'CheckCallAndFilter', |
26 'CheckCallAndFilterAndHeader', 'Error', 'ExecutionQueue', 'FileRead', | 26 'CheckCallAndFilterAndHeader', 'Error', 'ExecutionQueue', 'FileRead', |
27 'FileWrite', 'FindFileUpwards', 'FindGclientRoot', | 27 'FileWrite', 'FindFileUpwards', 'FindGclientRoot', |
28 'GetGClientRootAndEntries', 'GetNamedNodeText', | 28 'GetGClientRootAndEntries', 'GetNamedNodeText', 'MakeFileAutoFlush', |
29 'GetNodeNamedAttributeText', 'PathDifference', 'ParseXML', 'Popen', | 29 'GetNodeNamedAttributeText', 'PathDifference', 'ParseXML', 'Popen', |
30 'PrintableObject', 'RemoveDirectory', 'SplitUrlRevision', | 30 'PrintableObject', 'RemoveDirectory', 'SoftClone', 'SplitUrlRevision', |
31 'StdoutAnnotated', 'StdoutAutoFlush', 'SyntaxErrorToError', 'WorkItem', | 31 'StdoutAnnotated', 'SyntaxErrorToError', 'WorkItem', |
32 'copy', 'errno', 'logging', 'os', 'Queue', 're', 'stat', 'subprocess', | 32 'copy', 'errno', 'logging', 'os', 'Queue', 're', 'stat', 'subprocess', |
33 'sys','threading', 'time', 'xml', | 33 'sys','threading', 'time', 'xml', |
34 ] | 34 ] |
35 # If this test fails, you should add the relevant test. | 35 # If this test fails, you should add the relevant test. |
36 self.compareMembers(gclient_utils, members) | 36 self.compareMembers(gclient_utils, members) |
37 | 37 |
38 | 38 |
39 class CheckCallTestCase(GclientUtilBase): | 39 class CheckCallTestCase(GclientUtilBase): |
40 def testCheckCallSuccess(self): | 40 def testCheckCallSuccess(self): |
41 args = ['boo', 'foo', 'bar'] | 41 args = ['boo', 'foo', 'bar'] |
(...skipping 113 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 |