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
Carlos Ramos Carreño
erp5
Commits
cf7b8110
Commit
cf7b8110
authored
Jan 17, 2020
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: Make cookie generation request a bit more realistic.
parent
6940b138
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
product/ERP5/tests/testAutoLogout.py
product/ERP5/tests/testAutoLogout.py
+14
-3
product/ERP5Security/tests/testERP5Security.py
product/ERP5Security/tests/testERP5Security.py
+1
-0
No files found.
product/ERP5/tests/testAutoLogout.py
View file @
cf7b8110
...
@@ -28,7 +28,10 @@
...
@@ -28,7 +28,10 @@
#
#
##############################################################################
##############################################################################
from
functools
import
partial
from
StringIO
import
StringIO
import
unittest
import
unittest
import
urllib
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
DateTime
import
DateTime
from
DateTime
import
DateTime
...
@@ -69,9 +72,17 @@ class TestAuoLogout(ERP5TypeTestCase):
...
@@ -69,9 +72,17 @@ class TestAuoLogout(ERP5TypeTestCase):
portal
=
self
.
getPortal
()
portal
=
self
.
getPortal
()
request
=
self
.
app
.
REQUEST
request
=
self
.
app
.
REQUEST
stdin
=
urllib
.
urlencode
({
'__ac_name'
:
self
.
manager_username
,
'__ac_password'
:
self
.
manager_password
,
})
now
=
DateTime
()
now
=
DateTime
()
path
=
portal
.
absolute_url_path
()
+
'/view?__ac_name=%s&__ac_password=%s'
%
(
self
.
manager_username
,
self
.
manager_password
)
publish
=
partial
(
response
=
self
.
publish
(
path
)
self
.
publish
,
portal
.
absolute_url_path
()
+
'/view'
,
request_method
=
'POST'
,
)
response
=
publish
(
stdin
=
StringIO
(
stdin
))
self
.
assertIn
(
'Welcome to ERP5'
,
response
.
getBody
())
self
.
assertIn
(
'Welcome to ERP5'
,
response
.
getBody
())
# check '__ac' cookie has set an expire timeout
# check '__ac' cookie has set an expire timeout
...
@@ -86,7 +97,7 @@ class TestAuoLogout(ERP5TypeTestCase):
...
@@ -86,7 +97,7 @@ class TestAuoLogout(ERP5TypeTestCase):
self
.
tic
()
self
.
tic
()
portal
.
portal_caches
.
clearAllCache
()
portal
.
portal_caches
.
clearAllCache
()
response
=
self
.
publish
(
path
)
response
=
publish
(
stdin
=
StringIO
(
stdin
)
)
self
.
assertIn
(
'Welcome to ERP5'
,
response
.
getBody
())
self
.
assertIn
(
'Welcome to ERP5'
,
response
.
getBody
())
ac_cookie
=
response
.
getCookie
(
'__ac'
)
ac_cookie
=
response
.
getCookie
(
'__ac'
)
self
.
assertNotEqual
(
ac_cookie
,
None
)
self
.
assertNotEqual
(
ac_cookie
,
None
)
...
...
product/ERP5Security/tests/testERP5Security.py
View file @
cf7b8110
...
@@ -1292,6 +1292,7 @@ class TestAuthenticationCookie(UserManagementTestCase):
...
@@ -1292,6 +1292,7 @@ class TestAuthenticationCookie(UserManagementTestCase):
request
.
form
[
'__ac_name'
]
=
login
request
.
form
[
'__ac_name'
]
=
login
request
.
form
[
'__ac_password'
]
=
password
request
.
form
[
'__ac_password'
]
=
password
request
[
'PARENTS'
]
=
[
self
.
portal
]
request
[
'PARENTS'
]
=
[
self
.
portal
]
request
.
method
=
request
.
environ
[
'REQUEST_METHOD'
]
=
'POST'
# (the secure flag is only set if we accessed through https)
# (the secure flag is only set if we accessed through https)
request
.
setServerURL
(
'https'
,
'example.com'
)
request
.
setServerURL
(
'https'
,
'example.com'
)
...
...
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