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
Yoji Takeuchi
erp5
Commits
cd2a8367
Commit
cd2a8367
authored
Nov 20, 2018
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testERP5Security: test how ERP5 sets cookie attributes
parent
02756dcf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
product/ERP5Security/tests/testERP5Security.py
product/ERP5Security/tests/testERP5Security.py
+29
-0
No files found.
product/ERP5Security/tests/testERP5Security.py
View file @
cd2a8367
...
@@ -1273,6 +1273,35 @@ class TestOwnerRole(UserManagementTestCase):
...
@@ -1273,6 +1273,35 @@ class TestOwnerRole(UserManagementTestCase):
)
)
class
TestAuthenticationCookie
(
UserManagementTestCase
):
"""Test the authentication cookie.
Most of this functionality is already tested in testCookieiCrumbler, this
test uses a fully setup ERP5 site.
"""
def
testCookieAttributes
(
self
):
"""ERP5 sets some cookie attributes
"""
_
,
login
,
password
=
self
.
_makePerson
()
self
.
tic
()
request
=
self
.
portal
.
REQUEST
request
.
form
[
'__ac_name'
]
=
login
request
.
form
[
'__ac_password'
]
=
password
request
[
'PARENTS'
]
=
[
self
.
portal
]
# (the secure flag is only set if we accessed through https)
request
.
setServerURL
(
'https'
,
'example.com'
)
request
.
traverse
(
'/'
)
response
=
request
.
RESPONSE
ac_cookie
,
=
[
v
for
(
k
,
v
)
in
response
.
listHeaders
()
if
k
.
lower
()
==
'set-cookie'
and
'__ac='
in
v
]
# Secure flag so that cookie is sent only on https
self
.
assertIn
(
'; Secure'
,
ac_cookie
)
# HTTPOnly flag so that javascript cannot access cookie
self
.
assertIn
(
'; HTTPOnly'
,
ac_cookie
)
class
TestReindexObjectSecurity
(
UserManagementTestCase
):
class
TestReindexObjectSecurity
(
UserManagementTestCase
):
def
afterSetUp
(
self
):
def
afterSetUp
(
self
):
super
(
TestReindexObjectSecurity
,
self
).
afterSetUp
()
super
(
TestReindexObjectSecurity
,
self
).
afterSetUp
()
...
...
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