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
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
Eteri
erp5
Commits
87c0e746
Commit
87c0e746
authored
Jan 08, 2015
by
wenjie.zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_workflow: in testWorkflow5Mehtod add modification in Localizer, add Draft translation.
parent
de51a27f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
24 deletions
+16
-24
bt5/erp5_workflow/TestTemplateItem/portal_components/test.erp5.testWorkflow5Method.py
...teItem/portal_components/test.erp5.testWorkflow5Method.py
+16
-24
No files found.
bt5/erp5_workflow/TestTemplateItem/portal_components/test.erp5.testWorkflow5Method.py
View file @
87c0e746
...
...
@@ -18,7 +18,7 @@ class TestERP5Workflow(ERP5TypeTestCase):
def
test01_Erp5AccessorMethod
(
self
):
"""Generate Transition Methods and test these methods."""
# Create base category as the intermidiate
self
.
portal
.
portal_categories
.
newContent
(
'
category
_state'
)
self
.
portal
.
portal_categories
.
newContent
(
'
new
_state'
)
# Create a workflow
new_workflow
=
self
.
workflow_module
.
newContent
(
portal_type
=
'Workflow'
,
...
...
@@ -50,14 +50,14 @@ class TestERP5Workflow(ERP5TypeTestCase):
new_workflow
.
setSourceValue
(
s1
)
# state variable
new_workflow
.
setStateBaseCategory
(
'
category
_state'
,)
new_workflow
.
setStateBaseCategory
(
'
new
_state'
,)
# create a base type and a portal type based on this base type
type_object
=
self
.
portal
.
portal_types
.
newContent
(
portal_type
=
'Base Type'
,
id
=
'Object Type'
,
type_class
=
'XMLObject'
,
type_base_category_list
=
([
'
category
_state'
,])
type_base_category_list
=
([
'
new
_state'
,])
)
type_object
.
edit
(
type_erp5workflow_list
=
(
'new_workflow'
,))
...
...
@@ -77,37 +77,29 @@ class TestERP5Workflow(ERP5TypeTestCase):
self
.
assertTrue
(
new_object
is
not
None
)
self
.
assertEqual
(
new_object
.
getPortalType
(),
'Object Type'
)
self
.
assertEqual
(
new_object
.
getCategoryState
(),
'draft'
)
self
.
assertEqual
(
new_object
.
getCategoryStateTitle
(),
'Draft'
)
self
.
portal
.
Localizer
.
_default_language
=
'fr'
# switch language
message_catalog
=
self
.
portal
.
Localizer
.
erp5_ui
message_catalog
.
message_edit
(
'Draft'
,
'fr'
,
'Brouillon'
,
''
)
self
.
assertEqual
(
new_object
.
getNewState
(),
'draft'
)
self
.
assertEqual
(
new_object
.
getNewStateTitle
(),
'Draft'
)
self
.
assertEqual
(
new_object
.
getTranslatedNewStateTitle
(),
'Brouillon'
)
### execute transition
t1
.
execute
(
new_object
)
self
.
assertEqual
(
new_object
.
getCategoryStateTitle
(),
'Validated'
)
self
.
assertEqual
(
new_object
.
getNewStateTitle
(),
'Validated'
)
self
.
portal
.
Localizer
.
_default_language
=
'fr'
### call accessor
new_object
.
transition2
()
self
.
assertEqual
(
new_object
.
getCategoryStateTitle
(),
'Draft'
)
self
.
assertEqual
(
new_object
.
getTranslatedCategoryStateTitle
(),
'Brouillon'
)
self
.
assertEqual
(
new_object
.
getNewStateTitle
(),
'Draft'
)
new_object
.
transition1
()
self
.
assertEqual
(
new_object
.
get
Category
StateTitle
(),
'Validated'
)
self
.
assertEqual
(
new_object
.
get
New
StateTitle
(),
'Validated'
)
new_object
.
setToCouscousPlease
()
self
.
assertEqual
(
new_object
.
getCategoryStateTitle
(),
'Couscous'
)
"""
organisationX = self.portal.organisation_module.newContent(
portal_type='Organisation',
id='orgnisation_x')
self.portal.Localizer._default_language = 'fr'
self.assertEqual(organisationX.getValidationStateTitle(), 'Draft')
self.assertEqual(organisationX.getTranslatedValidationStateTitle(), 'Brouillon')
organisationX.validate()
self.assertEqual(organisationX.getValidationStateTitle(), 'Validated')
"""
self
.
assertEqual
(
new_object
.
getNewStateTitle
(),
'Couscous'
)
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