Commit 07dedbdd authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: erp5_trade: Migrate Unit Tests.

parent c7c2ad83
......@@ -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>
......@@ -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',
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.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>
......@@ -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>
test.erp5.testAmount
test.erp5.testDeliveryNode
test.erp5.testDivergenceTester
test.erp5.testERP5Simulation
......@@ -10,6 +11,8 @@ test.erp5.testOrderBuilder
test.erp5.testPackingList
test.erp5.testPackingListRoundingPrecision
test.erp5.testPurchaseOrder
test.erp5.testResource
test.erp5.testReturnedOrder
test.erp5.testReturnedSalePackingList
test.erp5.testSupply
test.erp5.testTradeReports
\ 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