OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 logging | 6 import logging |
7 import optparse | 7 import optparse |
8 import os | 8 import os |
9 import sys | 9 import sys |
10 from StringIO import StringIO | 10 from StringIO import StringIO |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 self._RunPublicTemplatesTest() | 103 self._RunPublicTemplatesTest() |
104 finally: | 104 finally: |
105 logging.error = logging_error | 105 logging.error = logging_error |
106 | 106 |
107 def testNonexistentFile(self): | 107 def testNonexistentFile(self): |
108 logging.getLogger().setLevel(logging.CRITICAL) | 108 logging.getLogger().setLevel(logging.CRITICAL) |
109 request = _MockRequest('extensions/junk.html') | 109 request = _MockRequest('extensions/junk.html') |
110 bad_response = _MockResponse() | 110 bad_response = _MockResponse() |
111 Handler(request, bad_response, local_path=BASE_PATH).get() | 111 Handler(request, bad_response, local_path=BASE_PATH).get() |
112 self.assertEqual(404, bad_response.status) | 112 self.assertEqual(404, bad_response.status) |
113 request_404 = _MockRequest('404.html') | 113 request_404 = _MockRequest('extensions/404.html') |
114 response_404 = _MockResponse() | 114 response_404 = _MockResponse() |
115 Handler(request_404, response_404, local_path=BASE_PATH).get() | 115 Handler(request_404, response_404, local_path=BASE_PATH).get() |
116 self.assertEqual(200, response_404.status) | 116 self.assertEqual(200, response_404.status) |
117 self.assertEqual(response_404.out.getvalue(), bad_response.out.getvalue()) | 117 self.assertEqual(response_404.out.getvalue(), bad_response.out.getvalue()) |
118 | 118 |
119 def testCron(self): | 119 def testCron(self): |
120 if EXPLICIT_TEST_FILES is not None: | 120 if EXPLICIT_TEST_FILES is not None: |
121 return | 121 return |
122 logging_error = logging.error | 122 logging_error = logging.error |
123 try: | 123 try: |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 suite.run(result) | 156 suite.run(result) |
157 if result.failures: | 157 if result.failures: |
158 print('*----------------------------------*') | 158 print('*----------------------------------*') |
159 print('| integration_test.py has failures |') | 159 print('| integration_test.py has failures |') |
160 print('*----------------------------------*') | 160 print('*----------------------------------*') |
161 for test, failure in result.failures: | 161 for test, failure in result.failures: |
162 print(test) | 162 print(test) |
163 print(failure) | 163 print(failure) |
164 exit(1) | 164 exit(1) |
165 exit(0) | 165 exit(0) |
OLD | NEW |