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

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

Issue 886903002: Slightly changed top-level redirect test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed integration test Created 5 years, 10 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
« no previous file with comments | « chrome/common/extensions/docs/server2/integration_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 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 unittest 6 import unittest
7 7
8 from extensions_paths import EXAMPLES, PUBLIC_TEMPLATES, STATIC_DOCS 8 from extensions_paths import EXAMPLES, PUBLIC_TEMPLATES, STATIC_DOCS
9 from local_file_system import LocalFileSystem 9 from local_file_system import LocalFileSystem
10 from render_servlet import RenderServlet 10 from render_servlet import RenderServlet
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 html_file = 'extensions/storage' 99 html_file = 'extensions/storage'
100 response = self._Render(html_file) 100 response = self._Render(html_file)
101 self.assertEqual(200, response.status) 101 self.assertEqual(200, response.status)
102 self.assertEqual('text/html; charset=utf-8', 102 self.assertEqual('text/html; charset=utf-8',
103 response.headers.get('Content-Type')) 103 response.headers.get('Content-Type'))
104 # Can't really test rendering all that well. 104 # Can't really test rendering all that well.
105 self.assertTrue(len(response.content) > 105 self.assertTrue(len(response.content) >
106 len(ReadFile('%s%s.html' % (PUBLIC_TEMPLATES, html_file)))) 106 len(ReadFile('%s%s.html' % (PUBLIC_TEMPLATES, html_file))))
107 107
108 def testIndexRender(self): 108 def testIndexRender(self):
109 response = self._Render('extensions') 109 self.assertEqual(200, self._Render('extensions').status)
110 self.assertEqual(200, response.status) 110 self.assertEqual(('/extensions', False),
111 self.assertEqual(self._Render('extensions/index').content.ToString(), 111 self._Render('extensions/index').GetRedirect())
112 response.content.ToString())
113 112
114 def testOtherRedirectsJsonRedirect(self): 113 def testOtherRedirectsJsonRedirect(self):
115 response = self._Render('apps/webview_tag') 114 response = self._Render('apps/webview_tag')
116 self.assertEqual(('/apps/tags/webview', False), 115 self.assertEqual(('/apps/tags/webview', False),
117 response.GetRedirect()) 116 response.GetRedirect())
118 117
119 def testDirectories(self): 118 def testDirectories(self):
120 # Directories should be redirected to a URL that doesn't end in a '/' 119 # Directories should be redirected to a URL that doesn't end in a '/'
121 # whether or not that exists. 120 # whether or not that exists.
122 self.assertEqual(('/dir', False), self._Render('dir/').GetRedirect()) 121 self.assertEqual(('/dir', False), self._Render('dir/').GetRedirect())
(...skipping 23 matching lines...) Expand all
146 self.assertEqual(content_type, response.headers.get('Content-Type')) 145 self.assertEqual(content_type, response.headers.get('Content-Type'))
147 self.assertEqual(etag, response.headers.get('ETag')) 146 self.assertEqual(etag, response.headers.get('ETag'))
148 147
149 # Test with a static path and a dynamic path. 148 # Test with a static path and a dynamic path.
150 test_path('static/css/out/site.css', 'text/css; charset=utf-8') 149 test_path('static/css/out/site.css', 'text/css; charset=utf-8')
151 test_path('extensions/storage', 'text/html; charset=utf-8') 150 test_path('extensions/storage', 'text/html; charset=utf-8')
152 151
153 152
154 if __name__ == '__main__': 153 if __name__ == '__main__':
155 unittest.main() 154 unittest.main()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/integration_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698