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

Side by Side Diff: chrome/common/extensions/docs/server2/integration_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 | « no previous file | chrome/common/extensions/docs/server2/render_servlet_test.py » ('j') | 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 # Run build_server so that files needed by tests are copied to the local 6 # Run build_server so that files needed by tests are copied to the local
7 # third_party directory. 7 # third_party directory.
8 import build_server 8 import build_server
9 build_server.main() 9 build_server.main()
10 10
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 def check_result(response): 180 def check_result(response):
181 self.assertEqual(200, response.status, 181 self.assertEqual(200, response.status,
182 'Got %s when rendering %s' % (response.status, path)) 182 'Got %s when rendering %s' % (response.status, path))
183 183
184 # This is reaaaaally rough since usually these will be tiny templates 184 # This is reaaaaally rough since usually these will be tiny templates
185 # that render large files. At least it'll catch zero-length responses. 185 # that render large files. At least it'll catch zero-length responses.
186 self.assertTrue(len(response.content) >= len(content), 186 self.assertTrue(len(response.content) >= len(content),
187 'Rendered content length was %s vs template content length %s ' 187 'Rendered content length was %s vs template content length %s '
188 'when rendering %s' % (len(response.content), len(content), path)) 188 'when rendering %s' % (len(response.content), len(content), path))
189 189
190 check_result(Handler(Request.ForTest(path)).Get()) 190 # TODO(kalman): Hack to avoid failing redirects like extensions/index
191 # to extensions. Better fix would be to parse or whitelist the
192 # redirects.json files as part of this test.
193 if not path.endswith('/index'):
194 check_result(Handler(Request.ForTest(path)).Get())
191 195
192 if path.startswith(('apps/', 'extensions/')): 196 if path.startswith(('apps/', 'extensions/')):
193 # Make sure that adding the .html will temporarily redirect to 197 # Make sure that adding the .html will temporarily redirect to
194 # the path without the .html for APIs and articles. 198 # the path without the .html for APIs and articles.
195 if '/examples/' not in path: 199 if '/examples/' not in path:
196 redirect_response = Handler(Request.ForTest(path + '.html')).Get() 200 redirect_response = Handler(Request.ForTest(path + '.html')).Get()
197 self.assertEqual( 201 self.assertEqual(
198 ('/' + path, False), redirect_response.GetRedirect(), 202 ('/' + path, False), redirect_response.GetRedirect(),
199 '%s.html did not (temporarily) redirect to %s (status %s)' % 203 '%s.html did not (temporarily) redirect to %s (status %s)' %
200 (path, path, redirect_response.status)) 204 (path, path, redirect_response.status))
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 parser.add_option('-v', '--verbose', action='store_true', default=False, 286 parser.add_option('-v', '--verbose', action='store_true', default=False,
283 help='Show verbose output like currently broken links') 287 help='Show verbose output like currently broken links')
284 (opts, args) = parser.parse_args() 288 (opts, args) = parser.parse_args()
285 if not opts.all: 289 if not opts.all:
286 _EXPLICIT_TEST_FILES = args 290 _EXPLICIT_TEST_FILES = args
287 _REBASE = opts.rebase 291 _REBASE = opts.rebase
288 _VERBOSE = opts.verbose 292 _VERBOSE = opts.verbose
289 # Kill sys.argv because we have our own flags. 293 # Kill sys.argv because we have our own flags.
290 sys.argv = [sys.argv[0]] 294 sys.argv = [sys.argv[0]]
291 unittest.main() 295 unittest.main()
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/docs/server2/render_servlet_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698