OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
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 | |
4 # found in the LICENSE file. | |
5 | |
6 import os | |
7 from StringIO import StringIO | |
8 import unittest | |
9 | |
10 import server_instance | |
11 | |
12 KNOWN_FAILURES = [ | |
13 'webstore.html', | |
14 ] | |
15 | |
16 class _MockResponse: | |
17 def __init__(self): | |
18 self.status = 200 | |
19 self.out = StringIO() | |
20 | |
21 def set_status(self, status): | |
22 self.status = status | |
23 | |
24 class _MockRequest: | |
25 def __init__(self): | |
26 self.headers = {} | |
27 | |
28 class IntegrationTest(unittest.TestCase): | |
29 def setUp(self): | |
30 self._instance = server_instance.GetInstanceForBranch('local', | |
31 None, | |
32 None, | |
33 '../..') | |
34 | |
35 def testAll(self): | |
36 for filename in os.listdir(os.path.join('templates', 'public')): | |
37 if filename in KNOWN_FAILURES: | |
38 continue | |
39 response = _MockResponse() | |
40 self._instance.Get(filename, _MockRequest(), response) | |
41 self.assertEqual(200, response.status) | |
not at google - send to devlin
2012/07/30 21:19:09
also assert that the response isn't empty?
cduvall
2012/07/30 22:48:09
Done.
| |
42 | |
43 def test404(self): | |
44 bad_response = _MockResponse() | |
45 self._instance.Get('junk', _MockRequest(), bad_response) | |
46 self.assertEqual(404, bad_response.status) | |
not at google - send to devlin
2012/07/30 21:19:09
ditto
cduvall
2012/07/30 22:48:09
Done.
| |
47 | |
48 if __name__ == '__main__': | |
49 unittest.main() | |
OLD | NEW |