Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs-appstore
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vincent Bechu
officejs-appstore
Commits
e5b483f3
Commit
e5b483f3
authored
May 30, 2017
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[officejs_test] Check the redirect web section
parent
1b5c1b23
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
1 deletion
+87
-1
bt5/officejs_test/TestTemplateItem/portal_components/test.erp5.testOfficeJSScenario.py
...eItem/portal_components/test.erp5.testOfficeJSScenario.py
+87
-1
No files found.
bt5/officejs_test/TestTemplateItem/portal_components/test.erp5.testOfficeJSScenario.py
View file @
e5b483f3
...
...
@@ -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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment