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

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

Issue 10828042: Extensions Docs Server: Integration testing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: refactor 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 | Annotate | Revision Log
OLDNEW
(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 from handler import Handler
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, path):
26 self.headers = {}
27 self.path = path
28
29 class IntegrationTest(unittest.TestCase):
30 def testAll(self):
31 for filename in os.listdir(os.path.join('templates', 'public')):
32 if filename in KNOWN_FAILURES:
33 continue
34 request = _MockRequest(filename)
35 response = _MockResponse()
36 Handler(request, response, local_path='../..').get()
37 self.assertEqual(200, response.status)
38 self.assertTrue(response.out.getvalue())
39
40 def test404(self):
41 request = _MockRequest('junk.html')
42 bad_response = _MockResponse()
43 Handler(request, bad_response, local_path='../..').get()
44 self.assertEqual(404, bad_response.status)
45 self.assertTrue(bad_response.out.getvalue())
46
47 if __name__ == '__main__':
48 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698