| 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 os | 7 import os |
| 8 from StringIO import StringIO | 8 from StringIO import StringIO |
| 9 import unittest | 9 import unittest |
| 10 | 10 |
| 11 import appengine_memcache as memcache | |
| 12 from fake_fetchers import ConfigureFakeFetchers | 11 from fake_fetchers import ConfigureFakeFetchers |
| 13 | 12 |
| 14 KNOWN_FAILURES = [ | 13 KNOWN_FAILURES = [ |
| 15 # Apps samples fails because it requires fetching data from github.com. | 14 # Apps samples fails because it requires fetching data from github.com. |
| 16 # This should be tested though: http://crbug.com/141910. | 15 # This should be tested though: http://crbug.com/141910. |
| 17 'apps/samples.html', | 16 'apps/samples.html', |
| 18 ] | 17 ] |
| 19 | 18 |
| 20 ConfigureFakeFetchers() | 19 ConfigureFakeFetchers() |
| 21 | 20 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 def testLocales(self): | 62 def testLocales(self): |
| 64 # Use US English, Spanish, and Arabic. | 63 # Use US English, Spanish, and Arabic. |
| 65 for lang in ['en-US', 'es', 'ar']: | 64 for lang in ['en-US', 'es', 'ar']: |
| 66 request = _MockRequest('extensions/samples.html') | 65 request = _MockRequest('extensions/samples.html') |
| 67 request.headers['Accept-Language'] = lang + ';q=0.8' | 66 request.headers['Accept-Language'] = lang + ';q=0.8' |
| 68 response = _MockResponse() | 67 response = _MockResponse() |
| 69 Handler(request, response, local_path='../..').get() | 68 Handler(request, response, local_path='../..').get() |
| 70 self.assertEqual(200, response.status) | 69 self.assertEqual(200, response.status) |
| 71 self.assertTrue(response.out.getvalue()) | 70 self.assertTrue(response.out.getvalue()) |
| 72 | 71 |
| 73 def testWarmupRequest(self): | |
| 74 request = _MockRequest('_ah/warmup') | |
| 75 response = _MockResponse() | |
| 76 Handler(request, response, local_path='../..').get() | |
| 77 self.assertEqual(200, response.status) | |
| 78 # Test that the pages were rendered by checking the size of the output. | |
| 79 # In python 2.6 there is no 'assertGreater' method. | |
| 80 value = response.out.getvalue() | |
| 81 self.assertTrue(len(value) > 100000, | |
| 82 msg='Response is too small, probably empty: %s' % value) | |
| 83 | |
| 84 if __name__ == '__main__': | 72 if __name__ == '__main__': |
| 85 unittest.main() | 73 unittest.main() |
| OLD | NEW |