Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: chrome/common/extensions/docs/server2/integration_test.py

Issue 10834130: Extensions Docs Server: Doc conversion script - SVN (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 'webstore.html', 15 'webstore.html',
16 'app.html',
17 'experimental_serial.html'
not at google - send to devlin 2012/08/07 02:42:14 commented this in a different patch, but adding a
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
26 class _MockRequest(object): 28 class _MockRequest(object):
27 def __init__(self, path): 29 def __init__(self, path):
28 self.headers = {} 30 self.headers = {}
29 self.path = path 31 self.path = path
30 32
31 class IntegrationTest(unittest.TestCase): 33 class IntegrationTest(unittest.TestCase):
32 def testAll(self): 34 def testAll(self):
33 base_path = os.path.join('templates', 'public') 35 base_path = os.path.join('templates', 'public')
34 for path, dirs, files in os.walk(base_path): 36 for path, dirs, files in os.walk(base_path):
35 for name in files: 37 for name in files:
36 filename = os.path.join(path, name) 38 filename = os.path.join(path, name)
37 if filename in KNOWN_FAILURES or filename.startswith('.'): 39 if name in KNOWN_FAILURES or '.' in path or name.startswith('.'):
38 continue 40 continue
39 request = _MockRequest(filename.split('/', 2)[-1]) 41 request = _MockRequest(filename.split('/', 2)[-1])
40 response = _MockResponse() 42 response = _MockResponse()
41 Handler(request, response, local_path='../..').get() 43 Handler(request, response, local_path='../..').get()
42 self.assertEqual(200, response.status) 44 self.assertEqual(200, response.status)
43 self.assertTrue(response.out.getvalue()) 45 self.assertTrue(response.out.getvalue())
44 46
45 def test404(self): 47 def test404(self):
46 request = _MockRequest('junk.html') 48 request = _MockRequest('junk.html')
47 bad_response = _MockResponse() 49 bad_response = _MockResponse()
(...skipping 20 matching lines...) Expand all
68 request = _MockRequest('_ah/warmup') 70 request = _MockRequest('_ah/warmup')
69 response = _MockResponse() 71 response = _MockResponse()
70 Handler(request, response, local_path='../..').get() 72 Handler(request, response, local_path='../..').get()
71 self.assertEqual(200, response.status) 73 self.assertEqual(200, response.status)
72 # Test that the pages were rendered by checking the size of the output. 74 # Test that the pages were rendered by checking the size of the output.
73 # In python 2.6 there is no 'assertGreater' method. 75 # In python 2.6 there is no 'assertGreater' method.
74 self.assertTrue(len(response.out.getvalue()) > 500000) 76 self.assertTrue(len(response.out.getvalue()) > 500000)
75 77
76 if __name__ == '__main__': 78 if __name__ == '__main__':
77 unittest.main() 79 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698