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 os | 6 import os |
7 from StringIO import StringIO | 7 from StringIO import StringIO |
8 import unittest | 8 import unittest |
9 | 9 |
10 import appengine_memcache as memcache | 10 import appengine_memcache as memcache |
11 import handler | 11 import handler |
12 from handler import Handler | 12 from handler import Handler |
13 import url_constants | |
13 | 14 |
14 KNOWN_FAILURES = [ | 15 KNOWN_FAILURES = [ |
15 'webstore.html', | 16 'webstore.html', |
17 'apps_samples.html' | |
not at google - send to devlin
2012/08/07 01:35:38
Perhaps we should add comments here explaining why
cduvall
2012/08/08 19:27:25
Done.
| |
16 ] | 18 ] |
17 | 19 |
18 class _MockResponse(object): | 20 class _MockResponse(object): |
19 def __init__(self): | 21 def __init__(self): |
20 self.status = 200 | 22 self.status = 200 |
21 self.out = StringIO() | 23 self.out = StringIO() |
22 | 24 |
23 def set_status(self, status): | 25 def set_status(self, status): |
24 self.status = status | 26 self.status = status |
25 | 27 |
(...skipping 26 matching lines...) Expand all Loading... | |
52 request = _MockRequest('samples.html') | 54 request = _MockRequest('samples.html') |
53 request.headers['Accept-Language'] = lang + ';q=0.8' | 55 request.headers['Accept-Language'] = lang + ';q=0.8' |
54 response = _MockResponse() | 56 response = _MockResponse() |
55 Handler(request, response, local_path='../..').get() | 57 Handler(request, response, local_path='../..').get() |
56 self.assertEqual(200, response.status) | 58 self.assertEqual(200, response.status) |
57 self.assertTrue(response.out.getvalue()) | 59 self.assertTrue(response.out.getvalue()) |
58 | 60 |
59 def testWarmupRequest(self): | 61 def testWarmupRequest(self): |
60 for branch in ['dev', 'trunk', 'beta', 'stable']: | 62 for branch in ['dev', 'trunk', 'beta', 'stable']: |
61 handler.BRANCH_UTILITY_MEMCACHE.Set( | 63 handler.BRANCH_UTILITY_MEMCACHE.Set( |
62 branch + '.' + handler.OMAHA_PROXY_URL, | 64 branch + '.' + url_constants.OMAHA_PROXY_URL, |
63 'local', | 65 'local', |
64 memcache.MEMCACHE_BRANCH_UTILITY) | 66 memcache.MEMCACHE_BRANCH_UTILITY) |
65 request = _MockRequest('_ah/warmup') | 67 request = _MockRequest('_ah/warmup') |
66 response = _MockResponse() | 68 response = _MockResponse() |
67 Handler(request, response, local_path='../..').get() | 69 Handler(request, response, local_path='../..').get() |
68 self.assertEqual(200, response.status) | 70 self.assertEqual(200, response.status) |
69 # Test that the pages were rendered by checking the size of the output. | 71 # Test that the pages were rendered by checking the size of the output. |
70 # In python 2.6 there is no 'assertGreater' method. | 72 # In python 2.6 there is no 'assertGreater' method. |
71 self.assertTrue(len(response.out.getvalue()) > 500000) | 73 self.assertTrue(len(response.out.getvalue()) > 500000) |
72 | 74 |
73 if __name__ == '__main__': | 75 if __name__ == '__main__': |
74 unittest.main() | 76 unittest.main() |
OLD | NEW |