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
Paul Graydon
erp5
Commits
9c04e13c
Commit
9c04e13c
authored
Jul 25, 2016
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testMRP: test behavior of adding and cloning transformed resource
parent
e02bdbdd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
+44
-0
product/ERP5/tests/testMRP.py
product/ERP5/tests/testMRP.py
+44
-0
No files found.
product/ERP5/tests/testMRP.py
View file @
9c04e13c
...
...
@@ -335,6 +335,50 @@ class TestMRPImplementation(TestMRPMixin):
(
self
.
consumed_resource_2
,
-
10.0
,
None
)]
self
.
checkExpectedLineList
(
production_report
,
expected_line_list
)
def
_test_add_and_clone_tranformed_resource
(
self
,
portal_type
):
test_product
=
self
.
portal
.
product_module
.
newContent
()
transformation
=
self
.
portal
.
transformation_module
.
newContent
(
portal_type
=
'Transformation'
,
reference
=
'TR1'
,
resource_value
=
test_product
)
transformed_resource
=
transformation
.
newContent
(
portal_type
=
portal_type
)
# transformation transformed resource is initialised with int index
self
.
assertEqual
(
1
,
transformed_resource
.
getIntIndex
())
transformed_resource_2
=
transformation
.
newContent
(
portal_type
=
portal_type
)
# int index increments as the number of lines increase
self
.
assertEqual
(
2
,
transformed_resource_2
.
getIntIndex
())
transformed_resource_2
.
setReference
(
'user defined reference'
)
# when cloning a transformation transformed resource, int index is also
# cloned and not incremented.
transformed_resource_3
=
transformed_resource_2
.
Base_createCloneDocument
(
batch_mode
=
True
)
self
.
assertEqual
(
2
,
transformed_resource_3
.
getIntIndex
())
self
.
assertEqual
(
'user defined reference'
,
transformed_resource_3
.
getReference
())
# Cloning a transformation properly keep the transformation transformed resources references
transformed_resource_2
.
setIntIndex
(
123
)
transformation_2
=
transformation
.
Base_createCloneDocument
(
batch_mode
=
True
)
self
.
assertEqual
(
1
,
transformation_2
[
'1'
].
getIntIndex
())
self
.
assertEqual
(
123
,
transformation_2
[
'2'
].
getIntIndex
())
self
.
assertEqual
(
2
,
transformation_2
[
'3'
].
getIntIndex
())
self
.
assertEqual
(
'user defined reference'
,
transformation_2
[
'2'
].
getReference
())
def
test_add_and_clone_transformation_transformed_resource
(
self
):
self
.
_test_add_and_clone_tranformed_resource
(
'Transformation Transformed Resource'
)
def
test_add_and_clone_transformation_optional_resource
(
self
):
self
.
_test_add_and_clone_tranformed_resource
(
'Transformation Optional Resource'
)
def
test_add_and_clone_transformation_operation
(
self
):
self
.
_test_add_and_clone_tranformed_resource
(
'Transformation Operation'
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestMRPImplementation
))
...
...
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