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
alecs_myu
erp5
Commits
31060427
Commit
31060427
authored
Jul 24, 2017
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMFActivity: Test hasErrorActivity
hasErrorActivity is tested on ActiveObject and ActiveProcess classes.
parent
65d77a47
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
0 deletions
+69
-0
product/CMFActivity/tests/testCMFActivity.py
product/CMFActivity/tests/testCMFActivity.py
+69
-0
No files found.
product/CMFActivity/tests/testCMFActivity.py
View file @
31060427
...
@@ -2334,6 +2334,75 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
...
@@ -2334,6 +2334,75 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
test
(
active_process
,
active_process
=
active_process
)
test
(
active_process
,
active_process
=
active_process
)
test
(
active_process
,
active_process
=
active_process
.
getPath
())
test
(
active_process
,
active_process
=
active_process
.
getPath
())
def
_test_hasErrorActivity_error
(
self
,
activity
):
# Monkey patch Organisation to add a failing method
def
failingMethod
(
self
):
raise
ValueError
(
'This method always fail'
)
Organisation
.
failingMethod
=
failingMethod
active_object
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
)
active_process
=
self
.
portal
.
portal_activities
.
newActiveProcess
()
self
.
tic
()
self
.
assertFalse
(
active_object
.
hasErrorActivity
())
self
.
assertFalse
(
active_process
.
hasErrorActivity
())
active_object
.
activate
(
activity
=
activity
,
active_process
=
active_process
).
failingMethod
()
self
.
commit
()
# assert that any activity is created
self
.
assertTrue
(
active_object
.
hasActivity
())
self
.
assertTrue
(
active_process
.
hasActivity
())
# assert that no error is reported
self
.
assertFalse
(
active_object
.
hasErrorActivity
())
self
.
assertFalse
(
active_process
.
hasErrorActivity
())
self
.
flushAllActivities
()
# assert that any activity is created
self
.
assertTrue
(
active_object
.
hasActivity
())
self
.
assertTrue
(
active_process
.
hasActivity
())
# assert that an error has been seen
self
.
assertTrue
(
active_object
.
hasErrorActivity
())
self
.
assertTrue
(
active_process
.
hasErrorActivity
())
def
test_hasErrorActivity_error_SQLQueue
(
self
):
self
.
_test_hasErrorActivity_error
(
'SQLQueue'
)
def
test_hasErrorActivity_error_SQLDict
(
self
):
self
.
_test_hasErrorActivity_error
(
'SQLDict'
)
def
_test_hasErrorActivity
(
self
,
activity
):
active_object
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
)
active_process
=
self
.
portal
.
portal_activities
.
newActiveProcess
()
self
.
tic
()
self
.
assertFalse
(
active_object
.
hasErrorActivity
())
self
.
assertFalse
(
active_process
.
hasErrorActivity
())
active_object
.
activate
(
activity
=
activity
,
active_process
=
active_process
).
getTitle
()
self
.
commit
()
# assert that any activity is created
self
.
assertTrue
(
active_object
.
hasActivity
())
self
.
assertTrue
(
active_process
.
hasActivity
())
# assert that no error is reported
self
.
assertFalse
(
active_object
.
hasErrorActivity
())
self
.
assertFalse
(
active_process
.
hasErrorActivity
())
self
.
flushAllActivities
()
# assert that any activity is created
self
.
assertFalse
(
active_object
.
hasActivity
())
self
.
assertFalse
(
active_process
.
hasActivity
())
# assert that no error is reported
self
.
assertFalse
(
active_object
.
hasErrorActivity
())
self
.
assertFalse
(
active_process
.
hasErrorActivity
())
def
test_hasErrorActivity_SQLQueue
(
self
):
self
.
_test_hasErrorActivity
(
'SQLQueue'
)
def
test_hasErrorActivity_SQLDict
(
self
):
self
.
_test_hasErrorActivity
(
'SQLDict'
)
def
test_active_object_hasActivity_does_not_catch_exceptions
(
self
):
def
test_active_object_hasActivity_does_not_catch_exceptions
(
self
):
"""
"""
Some time ago, hasActivity was doing a silent try/except, and this was
Some time ago, hasActivity was doing a silent try/except, and this was
...
...
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