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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
erp5
Commits
9562e715
Commit
9562e715
authored
May 19, 2017
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testAutoLogout: Use more appropriate assert* methods
Should make test output more expressive on failure.
parent
07ad98d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
product/ERP5/tests/testAutoLogout.py
product/ERP5/tests/testAutoLogout.py
+6
-6
No files found.
product/ERP5/tests/testAutoLogout.py
View file @
9562e715
...
...
@@ -72,14 +72,14 @@ class TestAuoLogout(ERP5TypeTestCase):
now
=
DateTime
()
path
=
portal
.
absolute_url_path
()
+
'/view?__ac_name=%s&__ac_password=%s'
%
(
self
.
manager_username
,
self
.
manager_password
)
response
=
self
.
publish
(
path
)
self
.
assert
True
(
'Welcome to ERP5'
in
response
.
getBody
())
self
.
assert
In
(
'Welcome to ERP5'
,
response
.
getBody
())
# check '__ac' cookie has set an expire timeout
ac_cookie
=
response
.
getCookie
(
'__ac'
)
self
.
assert
True
(
ac_cookie
is
not
None
)
self
.
assert
NotEqual
(
ac_cookie
,
None
)
cookie_expire
=
ac_cookie
[
'expires'
]
one_second
=
1
/
24.0
/
60.0
/
60.0
self
.
assert
True
((
now
+
6
*
one_second
)
>
DateTime
(
cookie_expire
))
# give 1s tollerance
self
.
assert
Greater
((
now
+
(
5
+
1
)
*
one_second
),
DateTime
(
cookie_expire
))
# give 1s tollerance
# if we disable auto-logout then cookie will expire at end of session
portal
.
portal_preferences
.
default_site_preference
.
disable
()
...
...
@@ -87,10 +87,10 @@ class TestAuoLogout(ERP5TypeTestCase):
portal
.
portal_caches
.
clearAllCache
()
response
=
self
.
publish
(
path
)
self
.
assert
True
(
'Welcome to ERP5'
in
response
.
getBody
())
self
.
assert
In
(
'Welcome to ERP5'
,
response
.
getBody
())
ac_cookie
=
response
.
getCookie
(
'__ac'
)
self
.
assert
True
(
ac_cookie
is
not
None
)
self
.
assert
True
(
ac_cookie
.
get
(
'expires'
,
None
)
is
None
)
self
.
assert
NotEqual
(
ac_cookie
,
None
)
self
.
assert
Equal
(
ac_cookie
.
get
(
'expires'
,
None
),
None
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
...
...
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