Commit d4f37f4a authored by Łukasz Nowak's avatar Łukasz Nowak

- do not use decorators for methods which are used in subclasses

 - use erp5_dummy_movement to achieve really low level testing, remove very dirty hacks for workflows


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28119 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1083fbce
...@@ -222,16 +222,16 @@ class TestBPMMixin(ERP5TypeTestCase): ...@@ -222,16 +222,16 @@ class TestBPMMixin(ERP5TypeTestCase):
itr.validate() itr.validate()
@reindex
def afterSetUp(self): def afterSetUp(self):
self.createCategories() self.createCategories()
self.setSystemPreference() self.setSystemPreference()
self.createInvoiceTransationRule() self.createInvoiceTransationRule()
self.stepTic()
@reindex
def beforeTearDown(self): def beforeTearDown(self):
self.portal.portal_rules.manage_delObjects( self.portal.portal_rules.manage_delObjects(
ids=['test_invoice_transaction_rule']) ids=['test_invoice_transaction_rule'])
self.stepTic()
class TestBPMImplementation(TestBPMMixin): class TestBPMImplementation(TestBPMMixin):
"""Business Process implementation tests""" """Business Process implementation tests"""
...@@ -600,31 +600,31 @@ class TestBPMisBuildableImplementation(TestBPMMixin): ...@@ -600,31 +600,31 @@ class TestBPMisBuildableImplementation(TestBPMMixin):
delivery_portal_type = 'Sale Packing List' delivery_portal_type = 'Sale Packing List'
delivery_line_portal_type = 'Sale Packing List Line' delivery_line_portal_type = 'Sale Packing List Line'
def _createDelivery(self, **kw):
return self.folder.newContent(portal_type='Dummy Delivery', **kw)
def _createMovement(self, delivery, **kw):
return delivery.newContent(portal_type='Dummy Movement', **kw)
def getBusinessTemplateList(self):
return TestBPMMixin.getBusinessTemplateList(self) + ('erp5_dummy_movement', )
def afterSetUp(self):
TestBPMMixin.afterSetUp(self)
if not hasattr(self.portal, 'testing_folder'):
self.portal.newContent(portal_type='Folder',
id='testing_folder')
self.folder = self.portal.testing_folder
self.stepTic()
def beforeTearDown(self):
TestBPMMixin.beforeTearDown(self)
self.portal.deleteContent(id='testing_folder')
self.stepTic()
def test_isBuildable(self): def test_isBuildable(self):
"""Test isBuildable implementation for Business Paths and Simulation Movements""" """Test isBuildable implementation for Business Paths and Simulation Movements"""
# disable interactions in workflow methods to do not have side effects and
# to increase readability of assertions and code
# FIXME:
# * do it non destructive way
# * trim list
# * or do it other way
for workflow_id in (
'delivery_causality_interaction_workflow',
'delivery_causality_workflow',
'delivery_movement_causality_interaction_workflow',
'delivery_movement_simulation_interaction_workflow',
'delivery_simulation_interaction_workflow',
'order_movement_simulation_interaction_workflow',
'order_simulation_interaction_workflow',
'order_workflow',
'packing_list_workflow',
):
workflow = getattr(self.portal.portal_workflow, workflow_id)
for script in workflow.scripts.objectValues():
script.write('return')
transaction.commit()
# simple business process preparation # simple business process preparation
business_process = self.createBusinessProcess() business_process = self.createBusinessProcess()
first_state = self.createBusinessState(business_process) first_state = self.createBusinessState(business_process)
...@@ -642,10 +642,8 @@ class TestBPMisBuildableImplementation(TestBPMMixin): ...@@ -642,10 +642,8 @@ class TestBPMisBuildableImplementation(TestBPMMixin):
trade_phase='default/invoicing') trade_phase='default/invoicing')
# create order and order line to have starting point for business process # create order and order line to have starting point for business process
order = self.portal.getDefaultModule( order = self._createDelivery()
portal_type=self.order_portal_type).newContent( order_line = self._createMovement(order)
portal_type=self.order_portal_type)
order_line = order.newContent(portal_type=self.order_line_portal_type)
# first level rule with simulation movement # first level rule with simulation movement
applied_rule = self.portal.portal_simulation.newContent( applied_rule = self.portal.portal_simulation.newContent(
...@@ -687,11 +685,8 @@ class TestBPMisBuildableImplementation(TestBPMMixin): ...@@ -687,11 +685,8 @@ class TestBPMisBuildableImplementation(TestBPMMixin):
False) False)
# add delivery # add delivery
delivery = self.portal.getDefaultModule( delivery = self._createDelivery(causality_value = order)
portal_type=self.delivery_portal_type).newContent( delivery_line = self._createMovement(delivery)
portal_type=self.delivery_portal_type, causality_value = order)
delivery_line = delivery.newContent(
portal_type=self.delivery_line_portal_type)
# relate not split movement with delivery (deliver it) # relate not split movement with delivery (deliver it)
simulation_movement.edit(delivery_value = delivery_line) simulation_movement.edit(delivery_value = delivery_line)
...@@ -718,8 +713,8 @@ class TestBPMisBuildableImplementation(TestBPMMixin): ...@@ -718,8 +713,8 @@ class TestBPMisBuildableImplementation(TestBPMMixin):
# put delivery in simulation state configured on path (and this state is # put delivery in simulation state configured on path (and this state is
# available directly on movements) # available directly on movements)
delivery.plan()
delivery.confirm() delivery.setSimulationState('confirmed')
self.assertEqual('confirmed', delivery.getSimulationState()) self.assertEqual('confirmed', delivery.getSimulationState())
......
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