Index: chrome/common/extensions/docs/server2/integration_test.py |
diff --git a/chrome/common/extensions/docs/server2/integration_test.py b/chrome/common/extensions/docs/server2/integration_test.py |
new file mode 100755 |
index 0000000000000000000000000000000000000000..6f18f26f94e08f924ed32d5e211161b7e64910c3 |
--- /dev/null |
+++ b/chrome/common/extensions/docs/server2/integration_test.py |
@@ -0,0 +1,48 @@ |
+#!/usr/bin/env python |
+# Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+import os |
+from StringIO import StringIO |
+import unittest |
+ |
+from handler import Handler |
+ |
+KNOWN_FAILURES = [ |
+ 'webstore.html', |
+] |
+ |
+class _MockResponse: |
+ def __init__(self): |
+ self.status = 200 |
+ self.out = StringIO() |
+ |
+ def set_status(self, status): |
+ self.status = status |
+ |
+class _MockRequest: |
+ def __init__(self, path): |
+ self.headers = {} |
+ self.path = path |
+ |
+class IntegrationTest(unittest.TestCase): |
+ def testAll(self): |
+ for filename in os.listdir(os.path.join('templates', 'public')): |
+ if filename in KNOWN_FAILURES: |
+ continue |
+ request = _MockRequest(filename) |
+ response = _MockResponse() |
+ Handler(request, response, local_path='../..').get() |
+ self.assertEqual(200, response.status) |
+ self.assertTrue(response.out.getvalue()) |
+ |
+ def test404(self): |
+ request = _MockRequest('junk.html') |
+ bad_response = _MockResponse() |
+ Handler(request, bad_response, local_path='../..').get() |
+ self.assertEqual(404, bad_response.status) |
+ self.assertTrue(bad_response.out.getvalue()) |
+ |
+if __name__ == '__main__': |
+ unittest.main() |