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
6f091944
Commit
6f091944
authored
Mar 19, 2015
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_workflow_test_data: tests' description cleanup.
parent
2d37b787
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
bt5/erp5_workflow_test_data/TestTemplateItem/portal_components/test.erp5.testWorkflowAndDCWorkflow.py
.../portal_components/test.erp5.testWorkflowAndDCWorkflow.py
+21
-9
No files found.
bt5/erp5_workflow_test_data/TestTemplateItem/portal_components/test.erp5.testWorkflowAndDCWorkflow.py
View file @
6f091944
...
@@ -42,37 +42,49 @@ class TestERP5WorkflowMixin(ERP5TypeTestCase):
...
@@ -42,37 +42,49 @@ class TestERP5WorkflowMixin(ERP5TypeTestCase):
def
test_03_testChangeOfState
(
self
):
def
test_03_testChangeOfState
(
self
):
new_object
=
self
.
getTestObject
()
new_object
=
self
.
getTestObject
()
self
.
doActionFor
(
new_object
,
"validate"
)
self
.
doActionFor
(
new_object
,
"validate"
)
self
.
assertEqual
(
self
.
getStateFor
(
new_object
),
'validated'
)
self
.
doActionFor
(
new_object
,
"invalidate"
)
self
.
doActionFor
(
new_object
,
"invalidate"
)
self
.
assertEqual
(
self
.
getStateFor
(
new_object
),
'invalidated'
)
self
.
assertEqual
(
self
.
getStateFor
(
new_object
),
'invalidated'
)
def
test_04_testDoWorkflowMethodTransition
(
self
):
def
test_04_testDoWorkflowMethodTransition
(
self
):
"""
Check if workflow methods allows to change of state
"""
new_object
=
self
.
getTestObject
()
new_object
=
self
.
getTestObject
()
self
.
assertEqual
(
self
.
getStateFor
(
new_object
),
'draft'
)
self
.
assertEqual
(
self
.
getStateFor
(
new_object
),
'draft'
)
# change state through a workflow method
new_object
.
validate
()
getattr
(
new_object
,
'validate'
)()
self
.
assertEqual
(
self
.
getStateFor
(
new_object
),
'validated'
)
self
.
assertEqual
(
self
.
getStateFor
(
new_object
),
'validated'
)
def
test_05_testCheckHistoryForASingleTransition
(
self
):
def
test_05_testCheckHistoryStateAndActionForASingleTransition
(
self
):
"""
Basic checking of workflow history, only check that state and actions
are available
"""
new_object
=
self
.
getTestObject
()
new_object
=
self
.
getTestObject
()
self
.
doActionFor
(
new_object
,
"validate"
)
self
.
doActionFor
(
new_object
,
"validate"
)
#print new_object.workflow_history
history_list
=
new_object
.
workflow_history
[
"testing_workflow"
]
history_list
=
new_object
.
workflow_history
[
"testing_workflow"
]
self
.
assertEqual
(
3
,
len
(
history_list
))
### creat->validation_action->validate
# 3 history lines are expected : draft->validation_action->validate
self
.
assertEqual
(
3
,
len
(
history_list
))
last_history
=
history_list
[
-
1
]
last_history
=
history_list
[
-
1
]
self
.
assertEqual
(
last_history
.
get
(
"action"
,
None
),
"validate"
)
self
.
assertEqual
(
last_history
.
get
(
"action"
,
None
),
"validate"
)
#raise NotImplementedError (new_object.workflow_history
)
self
.
assertEqual
(
last_history
.
get
(
"validation_state"
,
None
),
"validated"
)
def
test_06_testCheckPermissionAreWellSet
(
self
):
def
test_06_testCheckPermissionAreWellSet
(
self
):
new_object
=
self
.
getTestObject
()
new_object
=
self
.
getTestObject
()
self
.
assertEqual
(
new_object
.
_View_Permission
,
(
'Assignee'
,
'Assignor'
,
'Associate'
,
'Auditor'
,
'Author'
,
'Manager'
,
'Owner'
))
self
.
assertEqual
(
new_object
.
_View_Permission
,
(
'Assignee'
,
'Assignor'
,
'Associate'
,
'Auditor'
,
'Author'
,
'Manager'
,
'Owner'
))
self
.
doActionFor
(
new_object
,
"validate"
)
self
.
doActionFor
(
new_object
,
"validate"
)
self
.
assertEqual
(
new_object
.
_View_Permission
,
(
'Assignee'
,
'Assignor'
,
'Associate'
,
'Auditor'
,
'Manager'
))
self
.
assertEqual
(
new_object
.
_View_Permission
,
(
'Assignee'
,
'Assignor'
,
'Associate'
,
'Auditor'
,
'Manager'
))
def
test_07_testUserTransitionRaiseValidationFailed
(
self
):
def
test_07_testUserTransitionRaiseValidationFailed
(
self
):
"""
perform a fail_action which does nothing but add an error message in the workflow history
"""
new_object
=
self
.
getTestObject
()
new_object
=
self
.
getTestObject
()
exception_raised
=
False
exception_raised
=
False
try
:
try
:
self
.
doActionFor
(
new_object
,
"fail"
)
### perform a fail_action which does nothing but add an error message in the workflow history
self
.
doActionFor
(
new_object
,
"fail"
)
except
ValidationFailed
:
except
ValidationFailed
:
exception_raised
=
True
exception_raised
=
True
self
.
assertEqual
(
True
,
exception_raised
)
self
.
assertEqual
(
True
,
exception_raised
)
...
...
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