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
Hamza
erp5
Commits
da19fe40
Commit
da19fe40
authored
Dec 17, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 2 tests reproducing bugs in simulation
parent
ea15541d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
2 deletions
+54
-2
product/ERP5/tests/testRule.py
product/ERP5/tests/testRule.py
+54
-2
No files found.
product/ERP5/tests/testRule.py
View file @
da19fe40
...
@@ -26,8 +26,7 @@
...
@@ -26,8 +26,7 @@
##############################################################################
##############################################################################
import
unittest
import
unittest
from
Products.ERP5Type.tests.backportUnittest
import
expectedFailure
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5.tests.testOrder
import
TestOrderMixin
from
Products.ERP5.tests.testOrder
import
TestOrderMixin
...
@@ -683,6 +682,59 @@ return context.generatePredicate(
...
@@ -683,6 +682,59 @@ return context.generatePredicate(
self
.
getSimulationTool
().
_delObject
(
root_applied_rule
.
getId
())
self
.
getSimulationTool
().
_delObject
(
root_applied_rule
.
getId
())
self
.
tic
()
self
.
tic
()
def
_slowReindex
(
self
):
self
.
getRule
(
'default_delivery_rule'
).
validate
()
self
.
tic
()
self
.
pl
.
updateSimulation
(
create_root
=
1
)
self
.
tic
(
stop_condition
=
lambda
message_list
:
1
==
sum
(
1
for
m
in
message_list
if
m
.
method_id
==
'immediateReindexObject'
))
root_applied_rule
,
=
self
.
pl
.
getCausalityRelatedValueList
()
sm
,
=
root_applied_rule
.
objectValues
()
self
.
assertEqual
([],
sm
.
getDeliveryValue
().
getDeliveryRelatedList
())
return
root_applied_rule
@
expectedFailure
def
test_13_unlinkSimulation
(
self
):
"""
When a root delivery line is deleted, the related simulation movement
should be deleted at some point.
"""
root_applied_rule
=
self
.
_slowReindex
()
r
,
=
self
.
portal
.
cmf_activity_sql_connection
.
manage_test
(
'update message set priority = 127
\
0
select * from message'
)
self
.
assertEqual
(
r
.
processing_node
,
-
1
)
line_id
,
=
self
.
pl
.
objectIds
()
self
.
pl
.
_delObject
(
line_id
)
line
=
self
.
pl
.
newContent
(
portal_type
=
self
.
packing_list_line_portal_type
,
quantity
=
1
)
self
.
tic
()
sm
,
=
root_applied_rule
.
objectValues
()
self
.
assertEqual
(
line
,
sm
.
getDeliveryValue
())
def
test_14_indexRelated
(
self
):
"""Check that simulation is indexed before being updated
It is important that an update of a simulation tree is able to find all
related simulation movements, otherwise the following happends:
node 1 node2 2
start first indexing of SM ...
change simulation state of PL
update simulation (no SM found)
commit result of indexing
-> SM has wrong simulation state
"""
root_applied_rule
=
self
.
_slowReindex
()
self
.
portal
.
portal_activities
.
distribute
()
self
.
pl
.
updateSimulation
(
index_related
=
1
)
self
.
commit
()
# this should distribute nothing as long as the indexing activity
# is not processed
self
.
portal
.
portal_activities
.
distribute
()
r
,
=
self
.
portal
.
cmf_activity_sql_connection
.
manage_test
(
'select * from message_queue'
)
self
.
assertEqual
(
r
.
method_id
,
'_updateSimulation'
)
expectedFailure
(
self
.
assertEqual
)(
r
.
processing_node
,
-
1
)
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
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