Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Levin Zimmermann
erp5
Commits
0b7c1c3e
Commit
0b7c1c3e
authored
Aug 19, 2020
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testERP5WebWithDms: test Cache-Control header is overridden by Caching Policy Manager.
parent
b1f13fe2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
0 deletions
+68
-0
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testERP5WebWithDms.py
...ateItem/portal_components/test.erp5.testERP5WebWithDms.py
+68
-0
No files found.
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testERP5WebWithDms.py
View file @
0b7c1c3e
...
...
@@ -31,6 +31,7 @@ import unittest
import
os
import
quopri
import
functools
import
requests
from
StringIO
import
StringIO
from
lxml
import
etree
from
base64
import
b64decode
,
b64encode
...
...
@@ -1741,6 +1742,73 @@ return True
"""
self
.
checkWebSiteDocumentViewConsistency
(
"Drawing"
)
def
test_cache_control
(
self
):
# Cache-Control header is set to 'private' by CookieCrumbler for authenticated user.
# but can be overridden by Caching Policy Manager.
website
=
self
.
setupWebSite
()
released_page
=
self
.
portal
.
web_page_module
.
newContent
(
portal_type
=
'Web Page'
,
reference
=
'released_page'
,
)
released_page
.
release
()
published_page
=
self
.
portal
.
web_page_module
.
newContent
(
portal_type
=
'Web Page'
,
reference
=
'published_page'
,
)
published_page
.
publish
()
self
.
tic
()
auth_cookie
=
{
'__ac'
:
b64encode
(
'ERP5TypeTestCase:'
)}
# ERP5 portal, not through Caching Policy Manager
response
=
requests
.
get
(
self
.
portal
.
absolute_url
(),
cookies
=
auth_cookie
,
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
headers
[
'Cache-Control'
],
'private'
)
# released page
response
=
requests
.
get
(
'%s/%s'
%
(
website
.
absolute_url
(),
'released_page'
),
cookies
=
auth_cookie
,
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
headers
[
'Cache-Control'
],
'max-age=0, no-store'
)
# converted released page
response
=
requests
.
get
(
'%s/%s?format=txt'
%
(
website
.
absolute_url
(),
'released_page'
),
cookies
=
auth_cookie
,
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
headers
[
'Cache-Control'
],
'max-age=0, no-store'
)
# published page
response
=
requests
.
get
(
'%s/%s'
%
(
website
.
absolute_url
(),
'published_page'
),
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
headers
[
'Cache-Control'
],
'max-age=600, stale-while-revalidate=360000, public'
)
response
=
requests
.
get
(
'%s/%s'
%
(
website
.
absolute_url
(),
'published_page'
),
cookies
=
auth_cookie
,
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
headers
[
'Cache-Control'
],
'max-age=0, no-store'
)
# converted published page
response
=
requests
.
get
(
'%s/%s?format=txt'
%
(
website
.
absolute_url
(),
'published_page'
),
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
headers
[
'Cache-Control'
],
'max-age=600, stale-while-revalidate=360000, public'
)
response
=
requests
.
get
(
'%s/%s?format=txt'
%
(
website
.
absolute_url
(),
'published_page'
),
cookies
=
auth_cookie
,
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
headers
[
'Cache-Control'
],
'max-age=600, stale-while-revalidate=360000, public'
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestERP5WebWithDms
))
...
...
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