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 | 13 |
14 KNOWN_FAILURES = [ | 14 KNOWN_FAILURES = [ |
15 ] | 15 ] |
16 | 16 |
17 def _FakeGetBranchNumberForChannelName(channel_name): | |
18 return 'local' | |
19 handler.BRANCH_UTILITY.GetBranchNumberForChannelName = ( | |
20 _FakeGetBranchNumberForChannelName) | |
not at google - send to devlin
2012/08/13 00:53:00
I alluded to something like this in a bug report I
cduvall
2012/08/13 21:45:04
Done.
| |
21 | |
17 class _MockResponse(object): | 22 class _MockResponse(object): |
18 def __init__(self): | 23 def __init__(self): |
19 self.status = 200 | 24 self.status = 200 |
20 self.out = StringIO() | 25 self.out = StringIO() |
21 | 26 |
22 def set_status(self, status): | 27 def set_status(self, status): |
23 self.status = status | 28 self.status = status |
24 | 29 |
25 class _MockRequest(object): | 30 class _MockRequest(object): |
26 def __init__(self, path): | 31 def __init__(self, path): |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 request = _MockRequest('_ah/warmup') | 72 request = _MockRequest('_ah/warmup') |
68 response = _MockResponse() | 73 response = _MockResponse() |
69 Handler(request, response, local_path='../..').get() | 74 Handler(request, response, local_path='../..').get() |
70 self.assertEqual(200, response.status) | 75 self.assertEqual(200, response.status) |
71 # Test that the pages were rendered by checking the size of the output. | 76 # Test that the pages were rendered by checking the size of the output. |
72 # In python 2.6 there is no 'assertGreater' method. | 77 # In python 2.6 there is no 'assertGreater' method. |
73 self.assertTrue(len(response.out.getvalue()) > 500000) | 78 self.assertTrue(len(response.out.getvalue()) > 500000) |
74 | 79 |
75 if __name__ == '__main__': | 80 if __name__ == '__main__': |
76 unittest.main() | 81 unittest.main() |
OLD | NEW |