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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 # If this test fails, you should add the relevant test. | 62 # If this test fails, you should add the relevant test. |
63 self.compareMembers(gcl, members) | 63 self.compareMembers(gcl, members) |
64 | 64 |
65 | 65 |
66 def testHelp(self): | 66 def testHelp(self): |
67 old_stdout = sys.stdout | 67 old_stdout = sys.stdout |
68 try: | 68 try: |
69 dummy = StringIO.StringIO() | 69 dummy = StringIO.StringIO() |
70 gcl.sys.stdout = dummy | 70 gcl.sys.stdout = dummy |
71 gcl.Help() | 71 gcl.Help() |
72 self.assertEquals(len(dummy.getvalue()), 1718) | 72 self.assertEquals(len(dummy.getvalue()), 1813) |
73 finally: | 73 finally: |
74 gcl.sys.stdout = old_stdout | 74 gcl.sys.stdout = old_stdout |
75 | 75 |
76 def testGetRepositoryRoot(self): | 76 def testGetRepositoryRoot(self): |
77 try: | 77 try: |
78 def RunShellMock(filename): | 78 def RunShellMock(filename): |
79 return '<?xml version="1.0"?>\n<info>' | 79 return '<?xml version="1.0"?>\n<info>' |
80 gcl.RunShell = RunShellMock | 80 gcl.RunShell = RunShellMock |
81 gcl.GetRepositoryRoot() | 81 gcl.GetRepositoryRoot() |
82 except Exception,e: | 82 except Exception,e: |
(...skipping 17 matching lines...) Expand all Loading... |
100 self.assertEquals(o.name, 'name2') | 100 self.assertEquals(o.name, 'name2') |
101 self.assertEquals(o.issue, 'issue2') | 101 self.assertEquals(o.issue, 'issue2') |
102 self.assertEquals(o.description, 'description2') | 102 self.assertEquals(o.description, 'description2') |
103 self.assertEquals(o.files, files) | 103 self.assertEquals(o.files, files) |
104 self.assertEquals(o.patch, None) | 104 self.assertEquals(o.patch, None) |
105 self.assertEquals(o.FileList(), ['foo', 'bar']) | 105 self.assertEquals(o.FileList(), ['foo', 'bar']) |
106 | 106 |
107 | 107 |
108 if __name__ == '__main__': | 108 if __name__ == '__main__': |
109 unittest.main() | 109 unittest.main() |
OLD | NEW |