Commit e5b483f3 authored by Romain Courteaud's avatar Romain Courteaud

[officejs_test] Check the redirect web section

parent 1b5c1b23
......@@ -84,12 +84,81 @@ class TestOfficeJSScenario(SecurityTestCase):
)
###################################
### Anonymous: access the new application
### Anonymous: access the redirect application
self.logout()
api_scheme, api_netloc, api_path, api_query, \
api_fragment = urlparse.urlsplit(self.portal.absolute_url())
connection = httplib.HTTPConnection(api_netloc)
connection.request(
method='GET',
url='%s/' % web_section.getParentValue().absolute_url()
)
response = connection.getresponse()
page_content = response.read()
self.assertTrue(
'document.location.replace("%s/")' % web_section.getId() in page_content,
page_content
)
self.assertTrue(
'manifest="WebSection_renderOfficeJSRedirectAppCache"' in page_content,
page_content
)
self.assertEquals(response.status, 200)
self.assertEquals(
response.getheader('Cache-Control'),
'max-age=0, public, must-revalidate'
)
self.assertEquals(
response.getheader('Content-Type'),
'text/html; charset=utf-8'
)
self.assertEquals(
response.getheader('Content-Security-Policy'),
"default-src 'self'; script-src 'unsafe-inline';"
)
self.assertEquals(
response.getheader('X-Frame-Options'),
'SAMEORIGIN'
)
self.assertEquals(
response.getheader('Vary'),
'Accept-Language,Cookie,Authorization,Accept-Encoding'
)
###################################
### Anonymous: access the redirect application appcache
connection.request(
method='GET',
url='%s/WebSection_renderOfficeJSRedirectAppCache' % web_section.getParentValue().absolute_url()
)
response = connection.getresponse()
page_content = response.read()
self.assertEquals("""CACHE MANIFEST
# %s""" % web_section.getId(),
page_content
)
self.assertEquals(response.status, 200)
self.assertEquals(
response.getheader('Content-Type'),
'text/cache-manifest; charset=utf-8'
)
self.assertEquals(
response.getheader('Cache-Control'),
'max-age=0, public, must-revalidate'
)
self.assertEquals(
response.getheader('Vary'),
None
)
###################################
### Anonymous: access the application version
connection.request(
method='GET',
url='%s/' % web_section.absolute_url()
......@@ -98,3 +167,20 @@ class TestOfficeJSScenario(SecurityTestCase):
self.assertEquals(response.read(), 'My super content')
self.assertEquals(response.status, 200)
self.assertEquals(
response.getheader('Cache-Control'),
'max-age=31536000, stale-while-revalidate=31536000, stale-if-error=31536000, public'
)
self.assertEquals(
response.getheader('Content-Type'),
'text/html; charset=utf-8'
)
self.assertEquals(
response.getheader('Content-Security-Policy'),
None
)
self.assertEquals(
response.getheader('X-Frame-Options'),
None
)
self.assertEquals(response.getheader('Vary'), None)
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