Commit 1f661fa1 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: erp5_trade: Migrate Unit Tests.

parent f4cbf48d
......@@ -79,7 +79,7 @@ class TestAmount(ERP5TypeTestCase):
"""
return 1
def afterSetUp(self, quiet=1, run=run_all_test):
def afterSetUp(self, *args, **kw):
self.login()
def stepCreateResource(self, sequence=None, sequence_list=None, **kw):
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testAmount</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testAmount</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testAmount</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -64,7 +64,11 @@ class TestDomainTool(TestPredicateMixIn):
operator='AND',
portal_type=['!=%s' % x for x
in domain_tool.getPortalRuleTypeList()
+ ('Base Domain', 'Contribution Predicate')
+ ('Base Domain', 'Contribution Predicate',
'Solver Type', 'Trade Model Path')
+ domain_tool.getPortalDivergenceTesterTypeList()
+ domain_tool.getPortalBusinessProcessTypeList()
+ domain_tool.getPortalBusinessLinkTypeList()
+ domain_tool.getPortalConstraintTypeList()])
super(TestDomainTool, self).afterSetUp()
......@@ -120,14 +124,14 @@ class TestDomainTool(TestPredicateMixIn):
resource.setVariationBaseCategoryList(['variation'])
if resource.hasContent('default_supply_line'):
resource.deleteContent('default_supply_line')
self.supply_line = supply_line = resource.newContent(id='default_supply_line',portal_type='Supply Line')
self.supply_line = resource.newContent(id='default_supply_line',portal_type='Supply Line')
# Then create an order with a particular line
order_module = self.getSaleOrderModule()
if order_module.hasContent('1'):
order_module.deleteContent('1')
order = order_module.newContent(id='1',portal_type='Sale Order')
line = order.newContent(id='1',portal_type='Sale Order Line')
order.newContent(id='1',portal_type='Sale Order Line')
# Then create a base category
portal_categories = self.getCategoryTool()
......@@ -138,11 +142,11 @@ class TestDomainTool(TestPredicateMixIn):
portal_categories[bc].setAcquisitionCopyValue(0)
portal_categories[bc].setAcquisitionAppendValue(0)
if not 'europe' in portal_categories[bc].objectIds():
big_region = portal_categories[bc].newContent(id='europe',portal_type='Category')
portal_categories[bc].newContent(id='europe',portal_type='Category')
if not 'africa' in portal_categories[bc].objectIds():
big_region = portal_categories[bc].newContent(id='africa',portal_type='Category')
portal_categories[bc].newContent(id='africa',portal_type='Category')
if not 'asia' in portal_categories[bc].objectIds():
big_region = portal_categories[bc].newContent(id='asia',portal_type='Category')
portal_categories[bc].newContent(id='asia',portal_type='Category')
self.tic()
......@@ -275,16 +279,16 @@ class TestDomainTool(TestPredicateMixIn):
self.resource.setPVariationBaseCategoryList(['variation'])
self.supply_line.updateCellRange(base_id='path')
cell_range = self.supply_line.SupplyLine_asCellRange()
for range in cell_range[0]:
cell = self.supply_line.newCell(range,base_id='path',portal_type='Supply Cell')
for range_ in cell_range[0]:
cell = self.supply_line.newCell(range_,base_id='path',portal_type='Supply Cell')
cell.setMappedValuePropertyList(['base_price','priced_quantity'])
cell.setMultimembershipCriterionBaseCategoryList(['resource','variation'])
cell.setPricedQuantity(1)
if range.find('blue')>=0:
cell.setMembershipCriterionCategoryList([range])
if range_.find('blue')>=0:
cell.setMembershipCriterionCategoryList([range_])
cell.setBasePrice(45)
if range.find('red')>=0:
cell.setMembershipCriterionCategoryList([range])
if range_.find('red')>=0:
cell.setMembershipCriterionCategoryList([range_])
cell.setBasePrice(26)
right_price_list = [45,26]
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testDomainTool</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testDomainTool</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testDomainTool</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -441,7 +441,6 @@ class TestMovementGroupCommonAPI(MovementGroupTestCase):
def test_separateMethod(self):
"""Make sure that _separate method works if argument is an empty list."""
import Products.ERP5Type.Document
for portal_type in self.portal.portal_types.objectValues():
portal_type_id = portal_type.getId()
if portal_type_id.endswith("Movement Group"):
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testMovementGroup</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testMovementGroup</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testMovementGroup</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -70,7 +70,7 @@ class TestResource(ERP5TypeTestCase):
def getTitle(self):
return "Resource"
def login(self):
def login(self, *args, **kw):
uf = self.getPortal().acl_users
uf._doAddUser('rc', '', ['Manager'], [])
user = uf.getUserById('rc').__of__(uf)
......@@ -122,28 +122,25 @@ class TestResource(ERP5TypeTestCase):
size_category_list = ['Baby', 'Child', 'Man', 'Woman']
if len(self.category_tool.size.contentValues()) == 0 :
for category_id in size_category_list:
o = self.category_tool.size.newContent(portal_type='Category',
self.category_tool.size.newContent(portal_type='Category',
id=category_id)
self.size_category_list = map(lambda x: 'size/%s' % x,
size_category_list)
self.size_category_list = ['size/%s' % x for x in size_category_list]
colour_category_list = ['blue', 'green']
if len(self.category_tool.colour.contentValues()) == 0 :
for category_id in colour_category_list:
o = self.category_tool.colour.newContent(portal_type='Category',
id=category_id)
self.colour_category_list = map(lambda x: 'colour/%s' % x,
colour_category_list)
self.category_tool.colour.newContent(portal_type='Category',
id=category_id)
self.colour_category_list = ['colour/%s' % x for x in colour_category_list]
ind_phase_category_list = ['phase1', 'phase2']
if len(self.category_tool.industrial_phase.contentValues()) == 0:
for category_id in ind_phase_category_list:
o = self.category_tool.industrial_phase.newContent(
self.category_tool.industrial_phase.newContent(
portal_type='Category',
id=category_id)
self.industrial_phase_category_list = map(
lambda x: 'industrial_phase/%s' % x,
ind_phase_category_list)
self.industrial_phase_category_list = [
'industrial_phase/%s' % x for x in ind_phase_category_list]
self.morphology_category_list = []
self.base_category_content_list = {
......@@ -251,7 +248,7 @@ class TestResource(ERP5TypeTestCase):
Set category variation to current resource
"""
resource = sequence.get('resource')
size_list = map(lambda x: x[len('size/'):], self.size_list)
size_list = [x[len('size/'):] for x in self.size_list]
resource.setSizeList(size_list)
self.category_list = self.size_list[:]
......@@ -373,7 +370,7 @@ class TestResource(ERP5TypeTestCase):
resource = sequence.get('resource')
vrcl = resource.getVariationRangeCategoryList()
vrcil = resource.getVariationRangeCategoryItemList()
self.failIfDifferentSet(vrcl, map(lambda x: x[1], vrcil))
self.failIfDifferentSet(vrcl, [x[1] for x in vrcil])
def test_03_getVariationRangeCategoryItemList(self, quiet=quiet,
run=run_all_test):
......@@ -434,7 +431,7 @@ class TestResource(ERP5TypeTestCase):
resource = sequence.get('resource')
vcl = resource.getVariationCategoryList()
vcil = resource.getVariationCategoryItemList()
self.failIfDifferentSet(vcl, map(lambda x: x[1], vcil))
self.failIfDifferentSet(vcl, [x[1] for x in vcil])
def test_06_getVariationCategoryItemList(self, quiet=quiet, run=run_all_test):
"""
......@@ -452,7 +449,7 @@ class TestResource(ERP5TypeTestCase):
resource = sequence.get('resource')
vcl = resource.getVariationCategoryList(omit_individual_variation=0)
vcil = resource.getVariationCategoryItemList(omit_individual_variation=0)
self.failIfDifferentSet(vcl, map(lambda x: x[1], vcil))
self.failIfDifferentSet(vcl, [x[1] for x in vcil])
def test_07_getVariationCategoryItemList(self, quiet=quiet, run=run_all_test):
"""
......@@ -581,7 +578,7 @@ class TestResource(ERP5TypeTestCase):
]
return config
def logMessage(self, msg, tab=0):
def logMessage(self, msg, tab=0): # pylint: disable=arguments-differ
"""
Log a message.
"""
......@@ -611,7 +608,7 @@ class TestResource(ERP5TypeTestCase):
for key, value in config.items():
if key != 'price':
if value not in [None, []]:
if type(value) != type([]):
if not isinstance(value, list):
value_list = [value]
else:
value_list = value
......@@ -918,7 +915,6 @@ class TestResource(ERP5TypeTestCase):
# Initialize variables
product_module = self.portal.getDefaultModule(self.product_portal_type)
organisation_module = self.getOrganisationModule()
currency_module = self.getCurrencyModule()
sale_order_module = self.portal.getDefaultModule("Sale Order")
purchase_order_module = self.portal.getDefaultModule("Purchase Order")
internal_packing_list_module = self.portal.getDefaultModule("Internal Packing List")
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testResource</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testResource</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testResource</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testRoundingTool</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testRoundingTool</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testRoundingTool</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -33,7 +33,6 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import reindex
from Products.ERP5Type.tests.utils import SubcontentReindexingWrapper
from DateTime import DateTime
import transaction
class TestSupplyMixin:
def getBusinessTemplateList(self):
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testSupply</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testSupply</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testSupply</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -200,12 +200,12 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
self.assertEqual(map(set, matrix.getCellRange(**kwd)), map(set, cell_range))
for place in cartesianProduct(cell_range):
cell = matrix.newCell(portal_type="Purchase Order Cell",
matrix.newCell(portal_type="Purchase Order Cell",
*place, **kwd)
self.tic()
initial_cell_id_list = list(matrix.objectIds())
for id in initial_cell_id_list:
self.assertTrue(catalog.hasPath(url + '/' + id))
for id_ in initial_cell_id_list:
self.assertTrue(catalog.hasPath(url + '/' + id_))
cell_range = [['2', '3', '4'], ['b', 'c', 'd']]
matrix.setCellRange(*cell_range, **kwd)
......@@ -221,24 +221,24 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
['3', 'c']]:
self.assertNotEqual(None, matrix.getCell(*coord, **kwd))
removed_id_list = filter(lambda x: x not in next_cell_id_list,initial_cell_id_list)
removed_id_list = [x for x in initial_cell_id_list if x not in next_cell_id_list]
self.tic()
for id in next_cell_id_list:
self.assertTrue(catalog.hasPath(url + '/' + id))
for id in removed_id_list:
self.assertFalse(catalog.hasPath(url + '/' + id))
for id_ in next_cell_id_list:
self.assertTrue(catalog.hasPath(url + '/' + id_))
for id_ in removed_id_list:
self.assertFalse(catalog.hasPath(url + '/' + id_))
cell_range = [['0', '1'], ['a','b']]
matrix.setCellRange(*cell_range, **kwd)
self.commit()
self.assertEqual(map(set, matrix.getCellRange(**kwd)), map(set, cell_range))
next2_cell_id_list = list(matrix.objectIds())
removed_id_list = filter(lambda x: x not in next2_cell_id_list,next_cell_id_list)
removed_id_list = [x for x in next_cell_id_list if x not in next2_cell_id_list]
self.tic()
for id in next2_cell_id_list:
self.assertTrue(catalog.hasPath(url + '/' + id))
for id in removed_id_list:
self.assertFalse(catalog.hasPath(url + '/' + id))
for id_ in next2_cell_id_list:
self.assertTrue(catalog.hasPath(url + '/' + id_))
for id_ in removed_id_list:
self.assertFalse(catalog.hasPath(url + '/' + id_))
cell_range = [['0', '1'], ['a','b']]
kwd = {'base_id' : 'movement'}
......@@ -246,8 +246,8 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
self.commit()
self.assertEqual(map(set, matrix.getCellRange(**kwd)), map(set, cell_range))
self.tic()
for id in next2_cell_id_list:
self.assertFalse(catalog.hasPath(url + '/' + id))
for id_ in next2_cell_id_list:
self.assertFalse(catalog.hasPath(url + '/' + id_))
# create some cells
cell1 = matrix.newCell(*['0', 'a'], **kwd)
......@@ -308,13 +308,13 @@ class TestXMLMatrix(ERP5TypeTestCase, LogInterceptor):
kwd = {'base_id' : 'quantity'}
matrix.setCellRange(*cell_range, **kwd)
cell = matrix.newCell(*['1',], **kwd)
matrix.newCell(*['1',], **kwd)
self.tic()
cell_range = [['1', ], ['a', ]]
matrix.setCellRange(*cell_range, **kwd)
self.assertEqual(0, len(matrix.getCellValueList(**kwd)))
new_cell = matrix.newCell(*['1', 'a'], **kwd)
matrix.newCell(*['1', 'a'], **kwd)
self.tic()
def test_del_dimension(self):
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testXMLMatrix</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5Type.tests.testXMLMatrix</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testXMLMatrix</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
test.erp5.testAmount
test.erp5.testDeliveryNode
test.erp5.testDivergenceTester
test.erp5.testDomainTool
test.erp5.testERP5Simulation
test.erp5.testInternalOrder
test.erp5.testInventory
test.erp5.testInventoryModule
test.erp5.testInventoryReportModule
test.erp5.testMovementGroup
test.erp5.testOrder
test.erp5.testOrderBuilder
test.erp5.testPackingList
test.erp5.testPackingListRoundingPrecision
test.erp5.testPurchaseOrder
test.erp5.testResource
test.erp5.testReturnedOrder
test.erp5.testReturnedSalePackingList
test.erp5.testTradeReports
\ No newline at end of file
test.erp5.testRoundingTool
test.erp5.testSupply
test.erp5.testTradeReports
test.erp5.testXMLMatrix
\ No newline at end of file
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