Commit 349c263d authored by Alain Takoudjou's avatar Alain Takoudjou

slapos_accounting: Fix simultate method 'updateSimulation' and rewrite consistency messages

parent b76cd527
...@@ -479,6 +479,7 @@ class TestInstanceInvoicingAlarm(testSlapOSMixin): ...@@ -479,6 +479,7 @@ class TestInstanceInvoicingAlarm(testSlapOSMixin):
destination_section_value=person) destination_section_value=person)
instance = self.portal.software_instance_module\ instance = self.portal.software_instance_module\
.template_slave_instance.Base_createCloneDocument(batch_mode=1) .template_slave_instance.Base_createCloneDocument(batch_mode=1)
previous_delivery = self.portal.sale_packing_list_module.newContent( previous_delivery = self.portal.sale_packing_list_module.newContent(
portal_type='Sale Packing List') portal_type='Sale Packing List')
new_id = self.generateNewId() new_id = self.generateNewId()
...@@ -1329,6 +1330,9 @@ class TestSlapOSTriggerBuildAlarm(testSlapOSMixin): ...@@ -1329,6 +1330,9 @@ class TestSlapOSTriggerBuildAlarm(testSlapOSMixin):
@withAbort @withAbort
def test_SimulationMovement_buildSlapOS(self): def test_SimulationMovement_buildSlapOS(self):
build_simulator = tempfile.mkstemp()[1]
activate_simulator = tempfile.mkstemp()[1]
business_process = self.portal.business_process_module.newContent( business_process = self.portal.business_process_module.newContent(
portal_type='Business Process') portal_type='Business Process')
root_business_link = business_process.newContent( root_business_link = business_process.newContent(
...@@ -1346,8 +1350,6 @@ class TestSlapOSTriggerBuildAlarm(testSlapOSMixin): ...@@ -1346,8 +1350,6 @@ class TestSlapOSTriggerBuildAlarm(testSlapOSMixin):
causality=business_link.getRelativeUrl(), causality=business_link.getRelativeUrl(),
portal_type='Simulation Movement') portal_type='Simulation Movement')
build_simulator = tempfile.mkstemp()[1]
activate_simulator = tempfile.mkstemp()[1]
try: try:
from Products.CMFActivity.ActiveObject import ActiveObject from Products.CMFActivity.ActiveObject import ActiveObject
ActiveObject.original_activate = ActiveObject.activate ActiveObject.original_activate = ActiveObject.activate
...@@ -1411,6 +1413,9 @@ class TestSlapOSTriggerBuildAlarm(testSlapOSMixin): ...@@ -1411,6 +1413,9 @@ class TestSlapOSTriggerBuildAlarm(testSlapOSMixin):
@withAbort @withAbort
def test_SimulationMovement_buildSlapOS_withDelivery(self): def test_SimulationMovement_buildSlapOS_withDelivery(self):
build_simulator = tempfile.mkstemp()[1]
activate_simulator = tempfile.mkstemp()[1]
delivery = self.portal.sale_packing_list_module.newContent( delivery = self.portal.sale_packing_list_module.newContent(
portal_type='Sale Packing List') portal_type='Sale Packing List')
delivery_line = delivery.newContent(portal_type='Sale Packing List Line') delivery_line = delivery.newContent(portal_type='Sale Packing List Line')
...@@ -1433,8 +1438,6 @@ class TestSlapOSTriggerBuildAlarm(testSlapOSMixin): ...@@ -1433,8 +1438,6 @@ class TestSlapOSTriggerBuildAlarm(testSlapOSMixin):
delivery=delivery_line.getRelativeUrl(), delivery=delivery_line.getRelativeUrl(),
portal_type='Simulation Movement') portal_type='Simulation Movement')
build_simulator = tempfile.mkstemp()[1]
activate_simulator = tempfile.mkstemp()[1]
try: try:
from Products.CMFActivity.ActiveObject import ActiveObject from Products.CMFActivity.ActiveObject import ActiveObject
ActiveObject.original_activate = ActiveObject.activate ActiveObject.original_activate = ActiveObject.activate
...@@ -1501,17 +1504,18 @@ class TestSlapOSManageBuildingCalculatingDeliveryAlarm(testSlapOSMixin): ...@@ -1501,17 +1504,18 @@ class TestSlapOSManageBuildingCalculatingDeliveryAlarm(testSlapOSMixin):
@withAbort @withAbort
def _test_Delivery_manageBuildingCalculatingDelivery(self, state, empty=False): def _test_Delivery_manageBuildingCalculatingDelivery(self, state, empty=False):
updateCausalityState_simulator = tempfile.mkstemp()[1]
updateSimulation_simulator = tempfile.mkstemp()[1]
delivery = self.portal.sale_packing_list_module.newContent( delivery = self.portal.sale_packing_list_module.newContent(
title='Not visited by Delivery_manageBuildingCalculatingDelivery', title='Not visited by Delivery_manageBuildingCalculatingDelivery',
portal_type='Sale Packing List') portal_type='Sale Packing List')
self.portal.portal_workflow._jumpToStateFor(delivery, state) self.portal.portal_workflow._jumpToStateFor(delivery, state)
updateCausalityState_simulator = tempfile.mkstemp()[1]
updateSimulation_simulator = tempfile.mkstemp()[1]
try: try:
from Products.ERP5.Document.Delivery import Delivery from Products.ERP5.Document.Delivery import Delivery
Delivery.original_updateCausalityState = Delivery\ Delivery.original_updateCausalityState = Delivery.updateCausalityState
.updateCausalityState Delivery.original_updateSimulation = Delivery.updateSimulation
Delivery.updateCausalityState = Simulator( Delivery.updateCausalityState = Simulator(
updateCausalityState_simulator, 'updateCausalityState') updateCausalityState_simulator, 'updateCausalityState')
Delivery.updateSimulation = Simulator( Delivery.updateSimulation = Simulator(
...@@ -1540,7 +1544,9 @@ class TestSlapOSManageBuildingCalculatingDeliveryAlarm(testSlapOSMixin): ...@@ -1540,7 +1544,9 @@ class TestSlapOSManageBuildingCalculatingDeliveryAlarm(testSlapOSMixin):
) )
finally: finally:
Delivery.updateCausalityState = Delivery.original_updateCausalityState Delivery.updateCausalityState = Delivery.original_updateCausalityState
Delivery.updateSimulation = Delivery.original_updateSimulation
delattr(Delivery, 'original_updateCausalityState') delattr(Delivery, 'original_updateCausalityState')
delattr(Delivery, 'original_updateSimulation')
if os.path.exists(updateCausalityState_simulator): if os.path.exists(updateCausalityState_simulator):
os.unlink(updateCausalityState_simulator) os.unlink(updateCausalityState_simulator)
if os.path.exists(updateSimulation_simulator): if os.path.exists(updateSimulation_simulator):
......
...@@ -51,24 +51,24 @@ ...@@ -51,24 +51,24 @@
<string>W:350, 16: Unused variable \'update_line\' (unused-variable)</string> <string>W:350, 16: Unused variable \'update_line\' (unused-variable)</string>
<string>W:350, 29: Unused variable \'destroy_line\' (unused-variable)</string> <string>W:350, 29: Unused variable \'destroy_line\' (unused-variable)</string>
<string>W:407, 29: Unused variable \'destroy_line\' (unused-variable)</string> <string>W:407, 29: Unused variable \'destroy_line\' (unused-variable)</string>
<string>W:527, 29: Unused variable \'destroy_line\' (unused-variable)</string> <string>W:528, 29: Unused variable \'destroy_line\' (unused-variable)</string>
<string>W:527, 4: Unused variable \'setup_line\' (unused-variable)</string> <string>W:528, 4: Unused variable \'setup_line\' (unused-variable)</string>
<string>W:587, 4: Unused variable \'setup_line\' (unused-variable)</string> <string>W:588, 4: Unused variable \'setup_line\' (unused-variable)</string>
<string>W:648, 29: Unused variable \'destroy_line\' (unused-variable)</string> <string>W:649, 29: Unused variable \'destroy_line\' (unused-variable)</string>
<string>W:648, 4: Unused variable \'setup_line\' (unused-variable)</string> <string>W:649, 4: Unused variable \'setup_line\' (unused-variable)</string>
<string>W:687, 29: Unused variable \'destroy_line\' (unused-variable)</string> <string>W:688, 29: Unused variable \'destroy_line\' (unused-variable)</string>
<string>W:687, 4: Unused variable \'setup_line\' (unused-variable)</string> <string>W:688, 4: Unused variable \'setup_line\' (unused-variable)</string>
<string>W:1362, 20: Use of eval (eval-used)</string> <string>W:1364, 20: Use of eval (eval-used)</string>
<string>W:1363, 23: Use of eval (eval-used)</string> <string>W:1365, 23: Use of eval (eval-used)</string>
<string>W:1384, 20: Use of eval (eval-used)</string> <string>W:1386, 20: Use of eval (eval-used)</string>
<string>W:1385, 23: Use of eval (eval-used)</string> <string>W:1387, 23: Use of eval (eval-used)</string>
<string>W:1449, 20: Use of eval (eval-used)</string> <string>W:1452, 20: Use of eval (eval-used)</string>
<string>W:1450, 23: Use of eval (eval-used)</string> <string>W:1453, 23: Use of eval (eval-used)</string>
<string>W:1459, 20: Use of eval (eval-used)</string> <string>W:1462, 20: Use of eval (eval-used)</string>
<string>W:1460, 23: Use of eval (eval-used)</string> <string>W:1463, 23: Use of eval (eval-used)</string>
<string>W:1522, 35: Use of eval (eval-used)</string> <string>W:1526, 35: Use of eval (eval-used)</string>
<string>W:1523, 31: Use of eval (eval-used)</string> <string>W:1527, 31: Use of eval (eval-used)</string>
<string>W:1689, 4: Unused variable \'movement\' (unused-variable)</string> <string>W:1695, 4: Unused variable \'movement\' (unused-variable)</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -20,12 +20,12 @@ class TestHostingSubscription(TestSlapOSConstraintMixin): ...@@ -20,12 +20,12 @@ class TestHostingSubscription(TestSlapOSConstraintMixin):
portal_type='Hosting Subscription') portal_type='Hosting Subscription')
def afterSetUp(self): def afterSetUp(self):
super(TestHostingSubscription, self).afterSetUp() TestSlapOSConstraintMixin.afterSetUp(self)
self._createHostingSubscription() self._createHostingSubscription()
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
super(TestHostingSubscription, self).beforeTearDown() TestSlapOSConstraintMixin.beforeTearDown(self)
def test_periodicity_hour_list_value(self): def test_periodicity_hour_list_value(self):
value = 7 value = 7
...@@ -115,15 +115,15 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin): ...@@ -115,15 +115,15 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin):
def test_price_currency(self): def test_price_currency(self):
invoice = self.portal.accounting_module.newContent( invoice = self.portal.accounting_module.newContent(
portal_type='Sale Invoice Transaction') portal_type='Sale Invoice Transaction')
message = "Arity Error for Relation ['price_currency'], arity is equal "\ message = "Arity Error for Relation ['price_currency'] and Type "\
"to 0 but should be between 1 and 1" "('Currency',), arity is equal to 0 but should be between 1 and 1"
self._test_currency(invoice, invoice.setPriceCurrency, message) self._test_currency(invoice, invoice.setPriceCurrency, message)
def test_resource(self): def test_resource(self):
invoice = self.portal.accounting_module.newContent( invoice = self.portal.accounting_module.newContent(
portal_type='Sale Invoice Transaction') portal_type='Sale Invoice Transaction')
message = "Arity Error for Relation ['resource'], arity is equal "\ message = "Arity Error for Relation ['resource'] and Type "\
"to 0 but should be between 1 and 1" "('Currency',), arity is equal to 0 but should be between 1 and 1"
self._test_currency(invoice, invoice.setResource, message) self._test_currency(invoice, invoice.setResource, message)
@withAbort @withAbort
...@@ -131,8 +131,8 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin): ...@@ -131,8 +131,8 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin):
invoice = self.portal.accounting_module.newContent( invoice = self.portal.accounting_module.newContent(
portal_type='Sale Invoice Transaction') portal_type='Sale Invoice Transaction')
setter = invoice.setSpecialise setter = invoice.setSpecialise
message = "Arity Error for Relation ['specialise'], arity is equal "\ message = "Arity Error for Relation ['specialise'] and Type "\
"to 0 but should be at least 1" "('Sale Trade Condition',), arity is equal to 0 but should be at least 1"
self.assertTrue(message in self.getMessageList(invoice)) self.assertTrue(message in self.getMessageList(invoice))
sale_condition = self.portal.sale_trade_condition_module.newContent( sale_condition = self.portal.sale_trade_condition_module.newContent(
...@@ -264,10 +264,10 @@ class TestSalePackingList(TestSlapOSConstraintMixin): ...@@ -264,10 +264,10 @@ class TestSalePackingList(TestSlapOSConstraintMixin):
@withAbort @withAbort
def _test_category_arrow(self, category): def _test_category_arrow(self, category):
message = "Arity Error for Relation ['%s'], arity is equal to "\ message = "Arity Error for Relation ['%s'] and Type ('Organisation', "\
"0 but should be between 1 and 1" % category "'Person'), arity is equal to 0 but should be between 1 and 1" % category
message_2 = "Arity Error for Relation ['%s'], arity is equal to "\ message_2 = "Arity Error for Relation ['%s'] and Type ('Organisation', "\
"2 but should be between 1 and 1" % category "'Person'), arity is equal to 2 but should be between 1 and 1" % category
delivery = self.portal.sale_packing_list_module.newContent( delivery = self.portal.sale_packing_list_module.newContent(
portal_type='Sale Packing List') portal_type='Sale Packing List')
resource = self.portal.service_module.newContent( resource = self.portal.service_module.newContent(
...@@ -308,10 +308,10 @@ class TestSalePackingList(TestSlapOSConstraintMixin): ...@@ -308,10 +308,10 @@ class TestSalePackingList(TestSlapOSConstraintMixin):
@withAbort @withAbort
def test_specialise(self): def test_specialise(self):
category = 'specialise' category = 'specialise'
message = "Arity Error for Relation ['%s'], arity is equal to "\ message = "Arity Error for Relation ['%s'] and Type ('Sale Trade Condition"\
"0 but should be between 1 and 1" % category "',), arity is equal to 0 but should be between 1 and 1" % category
message_2 = "Arity Error for Relation ['%s'], arity is equal to "\ message_2 = "Arity Error for Relation ['%s'] and Type ('Sale Trade Condition"\
"2 but should be between 1 and 1" % category "',), arity is equal to 2 but should be between 1 and 1" % category
delivery = self.portal.sale_packing_list_module.newContent( delivery = self.portal.sale_packing_list_module.newContent(
portal_type='Sale Packing List') portal_type='Sale Packing List')
resource = self.portal.service_module.newContent( resource = self.portal.service_module.newContent(
...@@ -362,10 +362,10 @@ class TestSalePackingListLine(TestSlapOSConstraintMixin): ...@@ -362,10 +362,10 @@ class TestSalePackingListLine(TestSlapOSConstraintMixin):
@withAbort @withAbort
def test_resource_arity(self): def test_resource_arity(self):
category = 'resource' category = 'resource'
message = "Arity Error for Relation ['%s'], arity is equal to "\ message = "Arity Error for Relation ['%s'] and Type ('Service',), arity is"\
"0 but should be between 1 and 1" % category " equal to 0 but should be between 1 and 1" % category
message_2 = "Arity Error for Relation ['%s'], arity is equal to "\ message_2 = "Arity Error for Relation ['%s'] and Type ('Service',), arity is"\
"2 but should be between 1 and 1" % category " equal to 2 but should be between 1 and 1" % category
delivery_line = self.portal.sale_packing_list_module.newContent( delivery_line = self.portal.sale_packing_list_module.newContent(
portal_type='Sale Packing List').newContent( portal_type='Sale Packing List').newContent(
portal_type='Sale Packing List Line') portal_type='Sale Packing List Line')
......
...@@ -6,10 +6,22 @@ ...@@ -6,10 +6,22 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testSlapOSAccountingConstraint</string> </value> <value> <string>testSlapOSAccountingConstraint</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testSlapOSAccountingConstraint</string> </value> <value> <string>test.erp5.testSlapOSAccountingConstraint</string> </value>
...@@ -27,11 +39,7 @@ ...@@ -27,11 +39,7 @@
<item> <item>
<key> <string>text_content_error_message</string> </key> <key> <string>text_content_error_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>F: 7, 0: Unable to import \'testSlapOSCloudConstraint\' (import-error)</string>
<string>E: 22, 2: Use of super on an old style class (super-on-old-class)</string>
<string>E: 26, 2: Use of super on an old style class (super-on-old-class)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -47,13 +55,28 @@ ...@@ -47,13 +55,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -66,7 +89,7 @@ ...@@ -66,7 +89,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -75,7 +98,7 @@ ...@@ -75,7 +98,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle> </pickle>
......
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