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