Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
erp5
Commits
027a1fde
Commit
027a1fde
authored
May 29, 2015
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web: fix test related to caching policies
parent
c95eacfe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
product/ERP5/tests/testERP5WebWithDms.py
product/ERP5/tests/testERP5WebWithDms.py
+17
-6
No files found.
product/ERP5/tests/testERP5WebWithDms.py
View file @
027a1fde
...
...
@@ -434,6 +434,8 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
document
=
document_module
.
newContent
(
portal_type
=
document_portal_type
,
reference
=
'NXD-Document-TEXT.Cache'
)
document
.
publish
()
# Evaluation of last modification date for the site is cached
self
.
portal
.
portal_caches
.
clearCache
(
cache_factory_list
=
(
'erp5_content_short'
,
))
self
.
tic
()
response
=
self
.
publish
(
website_url
+
'/NXD-Document-TEXT.Cache'
)
last_modified_header
=
response
.
getHeader
(
'Last-Modified'
)
...
...
@@ -450,13 +452,14 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
reference
=
'P-DMS-Presentation.3.Pages'
document
.
edit
(
reference
=
reference
)
document
.
publish
()
self
.
portal
.
portal_caches
.
clearCache
(
cache_factory_list
=
(
'erp5_content_short'
,
))
self
.
tic
()
# Check we can access to the 3 drawings converted into images.
# Those images can be accessible through extensible content
# url : path-of-document + '/' + 'img' + page-index + '.png'
policy_list
=
self
.
portal
.
caching_policy_manager
.
listPolicies
()
policy
=
[
policy
[
1
]
for
policy
in
policy_list
\
if
policy
[
0
]
==
'unauthenticated'
][
0
]
if
policy
[
0
]
==
'unauthenticated
no language
'
][
0
]
for
i
in
xrange
(
3
):
path
=
'/'
.
join
((
website_url
,
reference
,
...
...
@@ -464,10 +467,15 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
response
=
self
.
publish
(
path
)
policy_list
=
self
.
portal
.
caching_policy_manager
.
listPolicies
()
policy
=
[
policy
for
policy
in
policy_list
\
if
policy
[
0
]
==
'unauthenticated'
][
0
]
if
policy
[
0
]
==
'unauthenticated
no language
'
][
0
]
self
.
assertEquals
(
response
.
getHeader
(
'Content-Type'
),
'image/png'
)
self
.
assertEquals
(
response
.
getHeader
(
'Cache-Control'
),
'max-age=%s, public'
%
policy
[
1
].
getMaxAgeSecs
())
self
.
assertEquals
(
response
.
getHeader
(
'Cache-Control'
),
'max-age=%s, stale-while-revalidate=%s, public'
%
(
policy
[
1
].
getMaxAgeSecs
(),
policy
[
1
].
getStaleWhileRevalidateSecs
(),
)
)
def
test_07_TestDocumentViewBehaviour
(
self
):
"""All Documents shared the same downloading behaviour
...
...
@@ -590,6 +598,8 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
document
=
document_module
.
newContent
(
portal_type
=
document_portal_type
,
reference
=
'NXD-Document-1-TEXT.Cache'
)
document
.
publish
()
# Evaluation of last modification date for the site is cached
self
.
portal
.
portal_caches
.
clearCache
(
cache_factory_list
=
(
'erp5_content_short'
,
))
self
.
tic
()
response
=
self
.
publish
(
website_url
+
'/NXD-Document-1-TEXT.Cache'
)
last_modified_header
=
response
.
getHeader
(
'Last-Modified'
)
...
...
@@ -606,20 +616,21 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
reference
=
'P-DMS-Presentation-001-.3.Pages'
document
.
edit
(
reference
=
reference
)
document
.
publish
()
self
.
portal
.
portal_caches
.
clearCache
(
cache_factory_list
=
(
'erp5_content_short'
,
))
self
.
tic
()
# Check we can access to the 3 drawings converted into images.
# Those images can be accessible through extensible content
# url : path-of-document + '/' + 'img' + page-index + '.png'
# Update policy to have stale values
self
.
portal
.
caching_policy_manager
.
_updatePolicy
(
"unauthenticated"
,
"python: member is None"
,
"unauthenticated
no language
"
,
"python: member is None"
,
"python: getattr(object, 'getModificationDate', object.modified)()"
,
1200
,
30
,
600
,
0
,
0
,
0
,
"Accept-Language, Cookie"
,
""
,
None
,
0
,
1
,
0
,
0
,
1
,
1
,
None
,
None
)
self
.
tic
()
policy_list
=
self
.
portal
.
caching_policy_manager
.
listPolicies
()
policy
=
[
policy
[
1
]
for
policy
in
policy_list
\
if
policy
[
0
]
==
'unauthenticated'
][
0
]
if
policy
[
0
]
==
'unauthenticated
no language
'
][
0
]
# Check policy has been updated
self
.
assertEquals
(
policy
.
getMaxAgeSecs
(),
1200
)
self
.
assertEquals
(
policy
.
getStaleWhileRevalidateSecs
(),
30
)
...
...
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