Commit cafe60a8 authored by Sebastien Robin's avatar Sebastien Robin

testInventory.py


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4815 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6cbe7bb9
...@@ -56,10 +56,8 @@ from Products.ERP5Type import product_path ...@@ -56,10 +56,8 @@ from Products.ERP5Type import product_path
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from testOrder import TestOrderMixin from testOrder import TestOrderMixin
class TestProductionOrder(TestOrderMixin, ERP5TypeTestCase): class TestProductionOrderMixin(TestOrderMixin):
"""
Test business template erp5_mrp
"""
run_all_test = 1 run_all_test = 1
order_portal_type = 'Production Order' order_portal_type = 'Production Order'
order_line_portal_type = 'Production Order Line' order_line_portal_type = 'Production Order Line'
...@@ -73,23 +71,6 @@ class TestProductionOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -73,23 +71,6 @@ class TestProductionOrder(TestOrderMixin, ERP5TypeTestCase):
operation_line_portal_type = 'Apparel Transformation Operation' operation_line_portal_type = 'Apparel Transformation Operation'
order_workflow_id='production_order_workflow' order_workflow_id='production_order_workflow'
def getTitle(self):
return "Production Order"
def enableLightInstall(self):
"""
You can override this.
Return if we should do a light install (1) or not (0)
"""
return 1
def enableActivityTool(self):
"""
You can override this.
Return if we should create (1) or not (0) an activity tool.
"""
return 1
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
""" """
""" """
...@@ -306,11 +287,16 @@ class TestProductionOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -306,11 +287,16 @@ class TestProductionOrder(TestOrderMixin, ERP5TypeTestCase):
sequence.edit(simulation_movement_list=simulation_movement_list) sequence.edit(simulation_movement_list=simulation_movement_list)
def checkObjectAttributes(self, object, attribute_list): def checkObjectAttributes(self, object, attribute_list):
LOG('checkObjectAttributes object.getPath',0,object.getPath())
for value, attribute in attribute_list: for value, attribute in attribute_list:
try: try:
self.assertEquals(value, self.assertEquals(value,
getattr(object, attribute)()) getattr(object, attribute)())
except AssertionError: except AssertionError:
LOG('Raise Assertion error',0,'')
LOG('object.getQuantity()',0,object.getQuantity())
LOG('object.__dict__',0,object.__dict__)
LOG('object.getOrderValue().getQuantity()',0,object.getOrderValue().getQuantity())
raise AssertionError, "Attribute: %s, Value: %s, Result: %s" %\ raise AssertionError, "Attribute: %s, Value: %s, Result: %s" %\
(attribute, value, getattr(object, attribute)()) (attribute, value, getattr(object, attribute)())
...@@ -382,30 +368,6 @@ class TestProductionOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -382,30 +368,6 @@ class TestProductionOrder(TestOrderMixin, ERP5TypeTestCase):
(None, 'getSourceValue'), (None, 'getSourceValue'),
(None, 'getSourceSectionValue'))) (None, 'getSourceSectionValue')))
def test_01_testProductionSimulationExpand(self, quiet=0, run=run_all_test):
"""
Test generation and update of order applied rule.
"""
if not run: return
sequence_list = SequenceList()
# Test when order is
sequence_string = '\
CreateProductionOrganisation1 \
CreateProductionSC \
CreateVariatedResource \
CreateComponent1 \
CreateTransformation \
CreateOrganisation \
CreateOrder \
CreateOrderLine \
Tic \
OrderOrder \
Tic \
CheckProductionSimulation \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepCreateSupplyOrganisation1(self, sequence=None, sequence_list=None, def stepCreateSupplyOrganisation1(self, sequence=None, sequence_list=None,
**kw): **kw):
""" """
...@@ -560,32 +522,6 @@ class TestProductionOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -560,32 +522,6 @@ class TestProductionOrder(TestOrderMixin, ERP5TypeTestCase):
(supply_organisation1, 'getSourceSectionValue'))) (supply_organisation1, 'getSourceSectionValue')))
self.assertEquals(0, len(supply_movement.objectValues())) self.assertEquals(0, len(supply_movement.objectValues()))
def test_02_testSourcingSimulationExpand(self, quiet=0,
run=run_all_test):
"""
Test generation and update of order applied rule.
"""
if not run: return
sequence_list = SequenceList()
# Test when order is
sequence_string = '\
CreateProductionOrganisation1 \
CreateSupplyOrganisation1 \
CreateSourcingSC \
CreateVariatedResource \
CreateComponent1 \
CreateTransformation \
CreateOrganisation \
CreateOrder \
CreateOrderLine \
Tic \
OrderOrder \
Tic \
CheckSourcingSimulation \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepCreateProductionOrganisation2(self, sequence=None, def stepCreateProductionOrganisation2(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
...@@ -906,6 +842,65 @@ class TestProductionOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -906,6 +842,65 @@ class TestProductionOrder(TestOrderMixin, ERP5TypeTestCase):
self.assertEquals(0, len(supply_movement.objectValues())) self.assertEquals(0, len(supply_movement.objectValues()))
class TestProductionOrder(TestProductionOrderMixin, ERP5TypeTestCase):
"""
Test business template erp5_mrp
"""
run_all_test = 1
def getTitle(self):
return "Production Order"
def test_01_testProductionSimulationExpand(self, quiet=0, run=run_all_test):
"""
Test generation and update of order applied rule.
"""
if not run: return
sequence_list = SequenceList()
# Test when order is
sequence_string = '\
CreateProductionOrganisation1 \
CreateProductionSC \
CreateVariatedResource \
CreateComponent1 \
CreateTransformation \
CreateOrganisation \
CreateOrder \
CreateOrderLine \
Tic \
OrderOrder \
Tic \
CheckProductionSimulation \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_02_testSourcingSimulationExpand(self, quiet=0,
run=run_all_test):
"""
Test generation and update of order applied rule.
"""
if not run: return
sequence_list = SequenceList()
# Test when order is
sequence_string = '\
CreateProductionOrganisation1 \
CreateSupplyOrganisation1 \
CreateSourcingSC \
CreateVariatedResource \
CreateComponent1 \
CreateTransformation \
CreateOrganisation \
CreateOrder \
CreateOrderLine \
Tic \
OrderOrder \
Tic \
CheckSourcingSimulation \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_03_testIndustrialPhase(self, quiet=0, run=run_all_test): def test_03_testIndustrialPhase(self, quiet=0, run=run_all_test):
""" """
""" """
...@@ -933,11 +928,3 @@ class TestProductionOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -933,11 +928,3 @@ class TestProductionOrder(TestOrderMixin, ERP5TypeTestCase):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
if __name__ == '__main__':
framework()
else:
import unittest
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestProductionOrder))
return suite
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