Commit 4b825f7d authored by Jérome Perrin's avatar Jérome Perrin

style changes

get_transaction -> transaction


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27275 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9c3c307c
......@@ -66,6 +66,7 @@ class TestItemMixin(TestSaleInvoiceMixin):
else:
organisation.edit(title=title)
return organisation
def createNotVariatedResource(self,title=None):
"""
Create a resource with no variation
......@@ -81,17 +82,16 @@ class TestItemMixin(TestSaleInvoiceMixin):
required_aggregated_portal_type_list=['Item']
)
return resource
def createVariatedResource(self,title=None):
preference = self.portal.portal_preferences
portal_workflow = self.portal.portal_workflow
pref = preference.newContent(portal_type='System Preference')
pref.setPreferredProductIndividualVariationBaseCategoryList(['size'])
portal_workflow.doActionFor(pref, 'enable_action')
get_transaction().commit()
transaction.commit()
self.tic()
# person = sequence.get('person')
portal = self.getPortal()
resource_portal_type = 'Product'
resource_module = portal.getDefaultModule(resource_portal_type)
......@@ -112,9 +112,8 @@ class TestItemMixin(TestSaleInvoiceMixin):
title = 'SizeVariation%s' % str(i)
)
resource_list = []
resource_list.append(resource)
return resource
def createPackingList(self,resource=None,organisation=None):
portal = self.getPortal()
packing_list_module = portal.getDefaultModule(portal_type='Purchase Packing List')
......@@ -136,6 +135,7 @@ class TestItemMixin(TestSaleInvoiceMixin):
destination_administration_value=organisation,
)
return pac_list
def createPackingListLine(self,packing_list=None,resource=None):
packing_list_line = packing_list.newContent(portal_type='Purchase Packing List Line')
packing_list_line.edit(
......@@ -143,6 +143,7 @@ class TestItemMixin(TestSaleInvoiceMixin):
)
packing_list_line.setResourceValue(resource)
return packing_list_line
def stepCreateItemList(self, sequence=None, sequence_list=None, **kw):
""" Create some items """
item_module = self.getPortal().item_module
......@@ -193,7 +194,7 @@ class TestItemMixin(TestSaleInvoiceMixin):
self.failUnless(item_list[0] in line.getAggregateValueList())
class TestItem(TestItemMixin, ERP5TypeTestCase) :
class TestItem(TestItemMixin, ERP5TypeTestCase):
run_all_test = 1
quiet = 0
......@@ -282,14 +283,14 @@ class TestItem(TestItemMixin, ERP5TypeTestCase) :
"""
if not run: return
organisation = self.createOrganisation(title='Organisation I')
get_transaction().commit()
transaction.commit()
self.tic()
resource = self.createVariatedResource()
get_transaction().commit()
transaction.commit()
self.tic()
packing_list = self.createPackingList(resource=resource,organisation=organisation)
packing_list_line= self.createPackingListLine(packing_list=packing_list,resource=resource)
get_transaction().commit()
transaction.commit()
self.tic()
# create a listbox
listbox = ({ 'listbox_key': '000',
......@@ -312,7 +313,7 @@ class TestItem(TestItemMixin, ERP5TypeTestCase) :
},
)
packing_list_line.DeliveryLine_createItemList(listbox=listbox)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(
len([x.getObject() for x in self.portal.portal_catalog(portal_type='Item',title='Lot A')]),1)
......@@ -339,15 +340,15 @@ class TestItem(TestItemMixin, ERP5TypeTestCase) :
"""
if not run: return
organisation = self.createOrganisation(title='Organisation II')
get_transaction().commit()
transaction.commit()
self.tic()
resource = self.createVariatedResource()
get_transaction().commit()
transaction.commit()
self.tic()
packing_list = self.createPackingList(resource=resource,organisation=organisation)
packing_list_line= self.createPackingListLine(packing_list=packing_list,resource=resource)
get_transaction().commit()
transaction.commit()
self.tic()
# create a listbox
listbox = ({ 'listbox_key': '000',
......@@ -376,14 +377,14 @@ class TestItem(TestItemMixin, ERP5TypeTestCase) :
},
)
packing_list_line.DeliveryLine_createItemList(listbox=listbox)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(packing_list_line.getQuantity(),35.0)
self.assertEquals(packing_list_line.getVariationCategoryList(),
['size/product_module/2/1','size/product_module/2/2'])
movement_cell_list = packing_list_line.contentValues(
portal_type='Purchase Packing List Cell')
for i in range(0,len(movement_cell_list)):
for i in range(0, len(movement_cell_list)):
self.assertEquals(movement_cell_list[i].getQuantity(),
listbox[i]['quantity'])
self.assertEquals(movement_cell_list[i].getAggregateTitle(),
......@@ -395,15 +396,15 @@ class TestItem(TestItemMixin, ERP5TypeTestCase) :
"""
if not run: return
organisation = self.createOrganisation(title='Organisation III')
get_transaction().commit()
transaction.commit()
self.tic()
resource = self.createNotVariatedResource()
get_transaction().commit()
transaction.commit()
self.tic()
packing_list = self.createPackingList(resource=resource,organisation=organisation)
packing_list_line= self.createPackingListLine(packing_list=packing_list,resource=resource)
get_transaction().commit()
transaction.commit()
self.tic()
# create a listbox
listbox = ({ 'listbox_key': '000',
......@@ -423,7 +424,7 @@ class TestItem(TestItemMixin, ERP5TypeTestCase) :
},
)
packing_list_line.DeliveryLine_createItemList(listbox=listbox)
get_transaction().commit()
transaction.commit()
self.tic()
self.assertEquals(
len([x.getObject() for x in self.portal.portal_catalog(portal_type='Item',title='Lot A3')]),1)
......@@ -439,6 +440,7 @@ class TestItem(TestItemMixin, ERP5TypeTestCase) :
portal_type='Purchase Packing List Cell')
self.assertEquals(movement_cell_list,[])
class TestItemScripts(ERP5TypeTestCase):
"""Test scripts from erp5_item.
"""
......@@ -584,7 +586,6 @@ class TestItemScripts(ERP5TypeTestCase):
self.item.Item_getVariationRangeCategoryItemList())
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestItem))
......
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