Commit ab9bec60 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

make a relation with a project in testOrder.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30051 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6148a1fe
...@@ -59,7 +59,8 @@ class TestOrderMixin: ...@@ -59,7 +59,8 @@ class TestOrderMixin:
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
""" """
""" """
return ('erp5_base','erp5_pdm', 'erp5_trade', 'erp5_apparel',) return ('erp5_base','erp5_pdm', 'erp5_trade', 'erp5_apparel',
'erp5_project')
def login(self, quiet=0, run=1): def login(self, quiet=0, run=1):
uf = self.getPortal().acl_users uf = self.getPortal().acl_users
...@@ -228,11 +229,31 @@ class TestOrderMixin: ...@@ -228,11 +229,31 @@ class TestOrderMixin:
organisation.edit(title=title) organisation.edit(title=title)
sequence.edit(**{title:organisation}) sequence.edit(**{title:organisation})
def stepCreateProject(self, sequence=None, sequence_list=None,
title=None, **kw):
"""
Create a project
"""
project = sequence.get('project')
project_portal_type = 'Project'
portal = self.getPortal()
project_module = portal.getDefaultModule( \
portal_type=project_portal_type)
project = project_module.newContent( \
portal_type=project_portal_type)
if title is None:
project.edit(title='project%s' % project.getId())
sequence.edit(project=project)
else:
project.edit(title=title)
sequence.edit(**{title:project})
def stepCreateOrder(self,sequence=None, sequence_list=None, **kw): def stepCreateOrder(self,sequence=None, sequence_list=None, **kw):
""" """
Create a empty order Create a empty order
""" """
organisation = sequence.get('organisation') organisation = sequence.get('organisation')
project = sequence.get('project')
# person = sequence.get('person') # person = sequence.get('person')
portal = self.getPortal() portal = self.getPortal()
order_module = portal.getDefaultModule(portal_type=self.order_portal_type) order_module = portal.getDefaultModule(portal_type=self.order_portal_type)
...@@ -253,6 +274,10 @@ class TestOrderMixin: ...@@ -253,6 +274,10 @@ class TestOrderMixin:
source_administration_value=organisation, source_administration_value=organisation,
destination_administration_value=organisation, destination_administration_value=organisation,
) )
if project is not None:
order.edit(source_project_value=project,
destination_project_value=project,
)
sequence.edit( order = order ) sequence.edit( order = order )
def stepCheckOrder(self, sequence=None, sequence_list=None, **kw): def stepCheckOrder(self, sequence=None, sequence_list=None, **kw):
...@@ -260,6 +285,7 @@ class TestOrderMixin: ...@@ -260,6 +285,7 @@ class TestOrderMixin:
Check if order was well created Check if order was well created
""" """
organisation = sequence.get('organisation') organisation = sequence.get('organisation')
project = sequence.get('project')
order = sequence.get('order') order = sequence.get('order')
self.assertEquals(self.datetime+10, order.getStartDate()) self.assertEquals(self.datetime+10, order.getStartDate())
self.assertEquals(self.datetime+20, order.getStopDate()) self.assertEquals(self.datetime+20, order.getStopDate())
...@@ -267,6 +293,8 @@ class TestOrderMixin: ...@@ -267,6 +293,8 @@ class TestOrderMixin:
self.assertEquals(organisation, order.getDestinationValue()) self.assertEquals(organisation, order.getDestinationValue())
self.assertEquals(organisation, order.getSourceSectionValue()) self.assertEquals(organisation, order.getSourceSectionValue())
self.assertEquals(organisation, order.getDestinationSectionValue()) self.assertEquals(organisation, order.getDestinationSectionValue())
self.assertEquals(project, order.getSourceProjectValue())
self.assertEquals(project, order.getDestinationProjectValue())
def stepCreateOrderLine(self,sequence=None, sequence_list=None, **kw): def stepCreateOrderLine(self,sequence=None, sequence_list=None, **kw):
...@@ -848,17 +876,39 @@ class TestOrderMixin: ...@@ -848,17 +876,39 @@ class TestOrderMixin:
organisation = sequence.get('organisation') organisation = sequence.get('organisation')
sequence.edit(organisation2=organisation) sequence.edit(organisation2=organisation)
def stepCreateProject1(self,sequence=None, sequence_list=None, **kw):
"""
Create a project
"""
self.stepCreateProject(sequence=sequence, sequence_list=sequence_list,
**kw)
project = sequence.get('project')
sequence.edit(project1=project)
def stepCreateProject2(self,sequence=None, sequence_list=None, **kw):
"""
Create a project
"""
self.stepCreateProject(sequence=sequence, sequence_list=sequence_list,
**kw)
project = sequence.get('project')
sequence.edit(project2=project)
def stepSetOrderProfile(self,sequence=None, sequence_list=None, **kw): def stepSetOrderProfile(self,sequence=None, sequence_list=None, **kw):
""" """
Set different source and destination on the order Set different source and destination on the order
""" """
organisation1 = sequence.get('organisation1') organisation1 = sequence.get('organisation1')
organisation2 = sequence.get('organisation2') organisation2 = sequence.get('organisation2')
project1 = sequence.get('project1')
project2 = sequence.get('project2')
order = sequence.get('order') order = sequence.get('order')
order.edit( source_value = organisation1, order.edit( source_value = organisation1,
source_section_value = organisation1, source_section_value = organisation1,
destination_value = organisation2, destination_value = organisation2,
destination_section_value = organisation2 ) destination_section_value = organisation2,
source_project_value = project1,
destination_project_value = project2 )
self.failUnless('Site Error' not in order.view()) self.failUnless('Site Error' not in order.view())
def stepCheckDeliveryBuilding(self, sequence=None, sequence_list=None, **kw): def stepCheckDeliveryBuilding(self, sequence=None, sequence_list=None, **kw):
...@@ -1475,6 +1525,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1475,6 +1525,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = '\ sequence_string = '\
stepCreateOrganisation \ stepCreateOrganisation \
stepCreateProject \
' + self.variated_order_line_creation + '\ ' + self.variated_order_line_creation + '\
stepCheckOrder \ stepCheckOrder \
stepCheckOrderInitialState \ stepCheckOrderInitialState \
...@@ -1501,6 +1552,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1501,6 +1552,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = '\ sequence_string = '\
stepCreateOrganisation \ stepCreateOrganisation \
stepCreateProject \
' + self.variated_order_line_creation + '\ ' + self.variated_order_line_creation + '\
stepCheckOrder \ stepCheckOrder \
stepCheckOrderInitialState \ stepCheckOrderInitialState \
...@@ -1528,6 +1580,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1528,6 +1580,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# Test when order is cancelled # Test when order is cancelled
sequence_string = '\ sequence_string = '\
stepCreateOrganisation \ stepCreateOrganisation \
stepCreateProject \
' + self.non_variated_order_creation + '\ ' + self.non_variated_order_creation + '\
stepCheckOrderSimulation \ stepCheckOrderSimulation \
stepPlanOrder \ stepPlanOrder \
...@@ -1546,6 +1599,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1546,6 +1599,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# Test with a simply order without cell # Test with a simply order without cell
sequence_string = '\ sequence_string = '\
stepCreateOrganisation \ stepCreateOrganisation \
stepCreateProject \
' + self.non_variated_order_creation + '\ ' + self.non_variated_order_creation + '\
stepPlanOrder \ stepPlanOrder \
stepTic \ stepTic \
...@@ -1562,6 +1616,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1562,6 +1616,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# Test to confirm order without planned or ordered it # Test to confirm order without planned or ordered it
sequence_string = '\ sequence_string = '\
stepCreateOrganisation \ stepCreateOrganisation \
stepCreateProject \
' + self.variated_order_line_creation + '\ ' + self.variated_order_line_creation + '\
stepSetOrderLineResource \ stepSetOrderLineResource \
stepSetOrderLineDefaultValues \ stepSetOrderLineDefaultValues \
...@@ -1577,6 +1632,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1577,6 +1632,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# Test to confirm order with variated resource # Test to confirm order with variated resource
sequence_string = '\ sequence_string = '\
stepCreateOrganisation \ stepCreateOrganisation \
stepCreateProject \
' + self.variated_order_creation + '\ ' + self.variated_order_creation + '\
stepTic \ stepTic \
stepOrderOrder \ stepOrderOrder \
...@@ -1591,6 +1647,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1591,6 +1647,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# Test to confirm order with multiples lines # Test to confirm order with multiples lines
sequence_string = '\ sequence_string = '\
stepCreateOrganisation \ stepCreateOrganisation \
stepCreateProject \
' + self.variated_order_creation + '\ ' + self.variated_order_creation + '\
stepCreateNotVariatedResource \ stepCreateNotVariatedResource \
stepTic \ stepTic \
...@@ -1618,6 +1675,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1618,6 +1675,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# Test when order is modified # Test when order is modified
sequence_string = '\ sequence_string = '\
stepCreateOrganisation \ stepCreateOrganisation \
stepCreateProject \
' + self.variated_order_creation + '\ ' + self.variated_order_creation + '\
stepOrderOrder \ stepOrderOrder \
stepTic \ stepTic \
...@@ -1629,6 +1687,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1629,6 +1687,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# Test when order line is modified # Test when order line is modified
sequence_string = '\ sequence_string = '\
stepCreateOrganisation \ stepCreateOrganisation \
stepCreateProject \
' + self.variated_order_creation + '\ ' + self.variated_order_creation + '\
stepOrderOrder \ stepOrderOrder \
stepTic \ stepTic \
...@@ -1640,6 +1699,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1640,6 +1699,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# Test when order cell is modified # Test when order cell is modified
sequence_string = '\ sequence_string = '\
stepCreateOrganisation \ stepCreateOrganisation \
stepCreateProject \
' + self.variated_order_creation + '\ ' + self.variated_order_creation + '\
stepOrderOrder \ stepOrderOrder \
stepTic \ stepTic \
...@@ -1652,6 +1712,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1652,6 +1712,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# Test when workflow state is modified # Test when workflow state is modified
sequence_string = '\ sequence_string = '\
stepCreateOrganisation \ stepCreateOrganisation \
stepCreateProject \
' + self.variated_order_creation + '\ ' + self.variated_order_creation + '\
stepPlanOrder \ stepPlanOrder \
stepTic \ stepTic \
...@@ -1687,6 +1748,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1687,6 +1748,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
sequence_string = '\ sequence_string = '\
stepCreateOrganisation1 \ stepCreateOrganisation1 \
stepCreateOrganisation2 \ stepCreateOrganisation2 \
stepCreateProject1 \
stepCreateProject2 \
stepCreateOrder \ stepCreateOrder \
stepSetOrderProfile \ stepSetOrderProfile \
stepCreateNotVariatedResource \ stepCreateNotVariatedResource \
...@@ -1707,6 +1770,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1707,6 +1770,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
sequence_string = '\ sequence_string = '\
stepCreateOrganisation1 \ stepCreateOrganisation1 \
stepCreateOrganisation2 \ stepCreateOrganisation2 \
stepCreateProject1 \
stepCreateProject2 \
stepCreateOrder \ stepCreateOrder \
stepSetOrderProfile \ stepSetOrderProfile \
stepCreateVariatedResource \ stepCreateVariatedResource \
...@@ -1727,6 +1792,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1727,6 +1792,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
sequence_string = '\ sequence_string = '\
stepCreateOrganisation1 \ stepCreateOrganisation1 \
stepCreateOrganisation2 \ stepCreateOrganisation2 \
stepCreateProject1 \
stepCreateProject2 \
stepCreateOrder \ stepCreateOrder \
stepSetOrderProfile \ stepSetOrderProfile \
stepCreateVariatedResource \ stepCreateVariatedResource \
...@@ -1752,6 +1819,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1752,6 +1819,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
sequence_string = '\ sequence_string = '\
stepCreateOrganisation1 \ stepCreateOrganisation1 \
stepCreateOrganisation2 \ stepCreateOrganisation2 \
stepCreateProject1 \
stepCreateProject2 \
stepCreateOrder \ stepCreateOrder \
stepSetOrderProfile \ stepSetOrderProfile \
stepCreateNotVariatedResource \ stepCreateNotVariatedResource \
...@@ -1775,6 +1844,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1775,6 +1844,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
sequence_string = '\ sequence_string = '\
stepCreateOrganisation1 \ stepCreateOrganisation1 \
stepCreateOrganisation2 \ stepCreateOrganisation2 \
stepCreateProject1 \
stepCreateProject2 \
stepCreateOrder \ stepCreateOrder \
stepSetOrderProfile \ stepSetOrderProfile \
stepCreateVariatedResource \ stepCreateVariatedResource \
...@@ -1810,6 +1881,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1810,6 +1881,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
sequence_string = '\ sequence_string = '\
stepCreateOrganisation1 \ stepCreateOrganisation1 \
stepCreateOrganisation2 \ stepCreateOrganisation2 \
stepCreateProject1 \
stepCreateProject2 \
stepTic \ stepTic \
stepCreateOrder \ stepCreateOrder \
stepSetOrderProfile \ stepSetOrderProfile \
...@@ -1853,6 +1926,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1853,6 +1926,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
sequence_string = '\ sequence_string = '\
stepCreateOrganisation1 \ stepCreateOrganisation1 \
stepCreateOrganisation2 \ stepCreateOrganisation2 \
stepCreateProject1 \
stepCreateProject2 \
stepCreateOrder \ stepCreateOrder \
stepSetOrderProfile \ stepSetOrderProfile \
stepCreateNotVariatedResource \ stepCreateNotVariatedResource \
...@@ -1879,6 +1954,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1879,6 +1954,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
sequence_string = '\ sequence_string = '\
stepCreateOrganisation1 \ stepCreateOrganisation1 \
stepCreateOrganisation2 \ stepCreateOrganisation2 \
stepCreateProject1 \
stepCreateProject2 \
stepCreateOrder \ stepCreateOrder \
stepSetOrderProfile \ stepSetOrderProfile \
stepCreateNotVariatedResource \ stepCreateNotVariatedResource \
...@@ -1920,6 +1997,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1920,6 +1997,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
sequence_string = '\ sequence_string = '\
stepCreateOrganisation \ stepCreateOrganisation \
stepCreateProject \
' + self.non_variated_order_creation + '\ ' + self.non_variated_order_creation + '\
stepTic \ stepTic \
stepCheckCatalogued \ stepCheckCatalogued \
...@@ -2365,6 +2443,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2365,6 +2443,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
# Test when order is cancelled # Test when order is cancelled
sequence_string = '\ sequence_string = '\
stepCreateOrganisation \ stepCreateOrganisation \
stepCreateProject \
' + hierarchical_order_creation + '\ ' + hierarchical_order_creation + '\
stepCheckOrderSimulation \ stepCheckOrderSimulation \
stepPlanOrder \ stepPlanOrder \
......
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