Commit 924b389a authored by Romain Courteaud's avatar Romain Courteaud

Check that simulation state is well indexed for simulation movement related to

an order.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17184 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2882138c
...@@ -991,6 +991,38 @@ class TestOrderMixin: ...@@ -991,6 +991,38 @@ class TestOrderMixin:
variated_order_creation_without_tic = variated_order_line_creation + \ variated_order_creation_without_tic = variated_order_line_creation + \
variated_line_completion_without_tic variated_line_completion_without_tic
def stepCheckCatalogued(self, sequence=None,
sequence_list=None, **kw):
"""
Check that order is catalogued
"""
order = sequence.get('order')
sql_connection = self.getSQLConnection()
sql = 'SELECT simulation_state FROM catalog WHERE uid=%s' % \
order.getUid()
result = sql_connection.manage_test(sql)
simulation_state_list = [x['simulation_state'] for x in result]
self.assertEquals(1, len(simulation_state_list))
self.assertEquals(order.getSimulationState(),
simulation_state_list[0])
def stepCheckCataloguedSimulation(self, sequence=None,
sequence_list=None, **kw):
"""
Check that simulation is catalogued
"""
order = sequence.get('order')
for order_movement in order.getMovementList():
for sim_mvt in order_movement.getOrderRelatedValueList():
sql_connection = self.getSQLConnection()
sql = 'SELECT simulation_state FROM catalog WHERE uid=%s' % \
sim_mvt.getUid()
result = sql_connection.manage_test(sql)
simulation_state_list = [x['simulation_state'] for x in result]
self.assertEquals(1, len(simulation_state_list))
self.assertEquals(order.getSimulationState(),
simulation_state_list[0])
class TestOrder(TestOrderMixin, ERP5TypeTestCase): class TestOrder(TestOrderMixin, ERP5TypeTestCase):
""" """
Test business template erp5_trade Test business template erp5_trade
...@@ -1793,6 +1825,37 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1793,6 +1825,37 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# if not run: return # if not run: return
# self.failUnless(1==2) # self.failUnless(1==2)
def test_18_SimulationStateIndexation(self, quiet=0, run=run_all_test):
"""
Test that the simulation state is well indexed.
"""
if not run: return
sequence_list = SequenceList()
sequence_string = '\
stepCreateOrganisation \
' + self.non_variated_order_creation + '\
stepTic \
stepCheckCatalogued \
stepCheckCataloguedSimulation \
stepPlanOrder \
stepTic \
stepCheckCatalogued \
stepCheckCataloguedSimulation \
stepOrderOrder \
stepTic \
stepCheckCatalogued \
stepCheckCataloguedSimulation \
stepCancelOrder \
stepTic \
stepCheckCatalogued \
stepCheckCataloguedSimulation \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestOrder)) suite.addTest(unittest.makeSuite(TestOrder))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment