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

Unified 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: fix for CQ Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
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..5508d63c202e2d3d595ccd0a50da35a2ed6dc471
--- /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 or filename.startswith('.'):
+ 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()

Powered by Google App Engine
This is Rietveld 408576698