Commit 341bea40 authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Extensions Docs] Update integration_test.py

Update the expectations in integration_test.py. For some files (like zip
files), the response may not exactly match the files on disk, and can be
smaller. This should be okay.

NOPRESUBMIT=true (tests running too slowly)

Bug: None
Test: chrome/common/extensions/docs/server2/integration_test.py --all
Change-Id: I13165e875f5896958ae58980b926b55296c04a7a
Reviewed-on: https://chromium-review.googlesource.com/1058134
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558983}
parent 8af94047
......@@ -166,15 +166,23 @@ class IntegrationTest(unittest.TestCase):
path = path_without_ext
def check_result(response):
is_ok = response.status == 200;
is_redirect = response.status == 302;
# TODO(dbertoni@chromium.org): Explore following redirects and/or
# keeping an explicit list of files that expect 200 vs. 302.
self.assertTrue(response.status == 200 or response.status == 302,
self.assertTrue(is_ok or is_redirect,
'Got %s when rendering %s' % (response.status, path))
self.assertTrue(is_redirect or len(response.content),
'Rendered content length was 0 when rendering %s' % path)
# This is reaaaaally rough since usually these will be tiny templates
# that render large files. At least it'll catch zero-length responses.
self.assertTrue(len(response.content) >= len(content) or
response.status == 302,
# that render large files.
self.assertTrue(is_redirect or
len(response.content) >= len(content) or
# Zip files may be served differently than stored
# locally.
path.endswith('.zip'),
'Rendered content length was %s vs template content length %s '
'when rendering %s' % (len(response.content), len(content), path))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment