Commit f4cbf48d authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: erp5_simplified_invoicing: Migrate Unit Tests.

parent 7168f05d
......@@ -28,7 +28,7 @@
import unittest
from DateTime import DateTime
from Products.ERP5.tests.testBPMCore import TestBPMMixin
from erp5.component.test.testBPMCore import TestBPMMixin
class TestMRPMixin(TestBPMMixin):
......
......@@ -27,7 +27,7 @@
#
##############################################################################
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5ReportTestCase
from Products.ERP5.tests.testTradeModelLine import TestTradeModelLineMixin
from erp5.component.test.testTradeModelLine import TestTradeModelLineMixin
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.utils import reindex
......
......@@ -166,7 +166,7 @@ class TestBPMMixin(ERP5TypeTestCase):
return business_link
def createTradeModelPath(self, business_process=None,
criterion_property_dict={}, **kw):
criterion_property_dict=None, **kw):
if business_process is None:
business_process = self.createBusinessProcess()
if kw.get('reference') and not kw.get('id'):
......@@ -175,8 +175,8 @@ class TestBPMMixin(ERP5TypeTestCase):
portal_type=self.trade_model_path_portal_type, **kw)
if criterion_property_dict:
trade_model_path._setCriterionPropertyList(tuple(criterion_property_dict))
for property, identity in criterion_property_dict.iteritems():
trade_model_path.setCriterion(property, identity)
for property_, identity in criterion_property_dict.iteritems():
trade_model_path.setCriterion(property_, identity)
reference = kw.get('reference', None)
if reference is not None:
setattr(self, reference, trade_model_path)
......@@ -605,6 +605,7 @@ class TestBPMImplementation(TestBPMDummyDeliveryMovementMixin):
checkExpectedDates(self.delivery_simulation_movement.getParentValue(),
base_date, base_date + 2)
# pylint: disable=anomalous-backslash-in-string
"""
XXX More complex scenarios must be tested, like when several path are
possible like this :
......
<?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>testBPMCore</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testBPMCore</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testBPMCore</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>
......@@ -28,7 +28,7 @@
##############################################################################
import unittest
from Products.ERP5.tests.testTradeModelLine import TestTradeModelLineMixin
from erp5.component.test.testTradeModelLine import TestTradeModelLineMixin
class TestComplexTradeModelLineUseCase(TestTradeModelLineMixin):
......
<?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>testComplexTradeModelLineUseCase</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testComplexTradeModelLineUseCase</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testComplexTradeModelLineUseCase</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>
......@@ -31,7 +31,7 @@ from test import pystone
from time import time
pystone.clock = time
from Products.ERP5Type.tests.runUnitTest import ERP5TypeTestLoader
from Products.ERP5.tests.testTradeModelLine import TestTradeModelLineSale
from erp5.component.test.testTradeModelLine import TestTradeModelLineSale
if ERP5TypeTestLoader._testMethodPrefix == 'test':
ERP5TypeTestLoader._testMethodPrefix = 'perf'
......
<?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>testSimulationPerformance</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testSimulationPerformance</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testSimulationPerformance</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>
......@@ -252,7 +252,7 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase):
# Order ---> TC (123)
#
# price should be 123
supply_line = self.trade_condition.newContent(
self.trade_condition.newContent(
portal_type=self.supply_line_type,
resource_value=self.resource,
base_price=123)
......@@ -347,10 +347,10 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase):
source_section_value=self.vendor,
destination_section_value=self.client)
other_supply.validate()
other_supply_line = other_supply.newContent(
other_supply.newContent(
portal_type=self.supply_line_type,
base_price=1)
supply_line = self.trade_condition.newContent(
self.trade_condition.newContent(
portal_type=self.supply_line_type,
resource_value=self.resource,
base_price=2)
......@@ -426,10 +426,10 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase):
source_section_value=self.vendor,
destination_section_value=self.client)
other_supply.validate()
other_supply_line = other_supply.newContent(
other_supply.newContent(
portal_type=self.supply_line_type,
base_price=1)
supply_line = self.trade_condition.newContent(
self.trade_condition.newContent(
portal_type=self.supply_line_type,
resource_value=self.resource,
base_price=2)
......@@ -458,11 +458,11 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase):
source_section_value=self.vendor,
destination_section_value=self.client)
other_supply.validate()
other_supply_line = other_supply.newContent(
other_supply.newContent(
portal_type=self.supply_line_type,
base_price=1)
self.trade_condition.setReference(self.id())
supply_line = self.trade_condition.newContent(
self.trade_condition.newContent(
portal_type=self.supply_line_type,
resource_value=self.resource,
base_price=2)
......@@ -482,7 +482,7 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase):
def test_supply_line_in_other_trade_condition_does_not_apply(self):
"""Supply lines from trade condition not related to an order does not apply.
"""
supply_line = self.trade_condition.newContent(
self.trade_condition.newContent(
portal_type=self.supply_line_type,
resource_value=self.resource,
base_price=2)
......@@ -502,14 +502,14 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase):
def test_supply_line_section(self):
# if a supply lines defines a section, it has priority over supply lines
# not defining sections
other_entity = self.portal.organisation_module.newContent(
self.portal.organisation_module.newContent(
portal_type='Organisation',
title='Other')
supply = self.portal.getDefaultModule(self.supply_type
).newContent(portal_type=self.supply_type,
resource_value=self.resource,)
supply.validate()
supply_line = supply.newContent(
supply.newContent(
portal_type=self.supply_line_type,
base_price=1)
......@@ -519,7 +519,7 @@ class TestTradeConditionSupplyLine(TradeConditionTestCase):
destination_section_value=self.client,
source_section_value=self.vendor)
other_supply.validate()
other_supply_line = other_supply.newContent(
other_supply.newContent(
portal_type=self.supply_line_type,
base_price=2)
......
<?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>testTradeCondition</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testTradeCondition</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testTradeCondition</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,7 @@ import random
import unittest
from unittest import expectedFailure
from Products.ERP5.tests.testBPMCore import TestBPMMixin
from erp5.component.test.testBPMCore import TestBPMMixin
from Products.ERP5Type.Base import Base
from Products.ERP5Type.Utils import simple_decorator
from DateTime import DateTime
......@@ -413,11 +413,11 @@ class TestTradeModelLine(TestTradeModelLineMixin):
def checkTradeModelRuleSimulationExpand(self, delivery):
expected_result_dict = self[delivery.getPath()]
price_currency = self['price_currency']
for line in delivery.getMovementList():
simulation_movement_list, = \
self.getTradeModelSimulationMovementList(line)
simulation_movement_list_list = self.getTradeModelSimulationMovementList(line)
self.assertEqual(len(simulation_movement_list_list), 1)
simulation_movement_list = simulation_movement_list_list[0]
result_dict = {sm.getResourceValue().getUse(): sm
for sm in simulation_movement_list}
self.assertEqual(len(simulation_movement_list),
......@@ -662,7 +662,7 @@ class TestTradeModelLine(TestTradeModelLineMixin):
self.test_01_OrderWithSimpleTaxedAndDiscountedLines('packing_list')
for line in packing_list.getMovementList():
line.setQuantity(line.getQuantity() *
line.setQuantity(line.getQuantity() *
self.modified_packing_list_line_quantity_ratio)
self.tic()
self.checkCausalityState(packing_list, 'diverged')
......@@ -1179,10 +1179,10 @@ return lambda *args, **kw: 1""")
base_contribution_list = 'base_amount/tax', bounded_fee
kw = {'portal_type': self.order_line_portal_type,
'base_contribution_list': base_contribution_list}
order_line_1 = order.newContent(price=1000, quantity=1,
resource_value=resource_A, **kw)
order_line_2 = order.newContent(price=500, quantity=1,
resource_value=resource_B, **kw)
order.newContent(price=1000, quantity=1,
resource_value=resource_A, **kw)
order.newContent(price=500, quantity=1,
resource_value=resource_B, **kw)
amount_list = order.getGeneratedAmountList()
self.assertEqual([75], [x.getTotalPrice() for x in amount_list])
......@@ -1206,12 +1206,12 @@ return lambda *args, **kw: 1""")
base_application=fixed_quantity,
price=1)
# for delivery level
discount = self.createTradeModelLine(trade_condition,
reference='DISCOUNT_B',
resource_value=tax,
base_application=fixed_quantity,
target_delivery=True,
quantity=10, price=-1)
self.createTradeModelLine(trade_condition,
reference='DISCOUNT_B',
resource_value=tax,
base_application=fixed_quantity,
target_delivery=True,
quantity=10, price=-1)
self.commit()# flush transactional cache
......
<?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>testTradeModelLine</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testTradeModelLine</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testTradeModelLine</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>
......@@ -28,7 +28,7 @@
##############################################################################
import unittest
from Products.ERP5.tests.testTradeModelLine import TestTradeModelLine
from erp5.component.test.testTradeModelLine import TestTradeModelLine
class TestTradeModelLinePurchase(TestTradeModelLine):
invoice_portal_type = 'Purchase Invoice Transaction'
......
<?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>testTradeModelLinePurchase</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testTradeModelLinePurchase</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testTradeModelLinePurchase</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.testBPMCore
test.erp5.testComplexTradeModelLineUseCase
test.erp5.testDeliveryBuilderToSupportMultipleLines
test.erp5.testInvoice
\ No newline at end of file
test.erp5.testInvoice
test.erp5.testSimulationPerformance
test.erp5.testTradeCondition
test.erp5.testTradeModelLine
test.erp5.testTradeModelLinePurchase
\ No newline at end of file
......@@ -5,9 +5,10 @@ erp5_simulation
erp5_apparel
erp5_project
erp5_configurator_standard_solver
erp5_simulation_test_trade_template
erp5_simulation_test
erp5_simulation_test_trade_template
erp5_administration
erp5_dummy_movement
erp5_configurator_standard_accounting_template
erp5_configurator_standard_invoicing_template
\ No newline at end of file
erp5_configurator_standard_invoicing_template
erp5_item
\ 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