Commit 44493e2e authored by Rafael Monnerat's avatar Rafael Monnerat

SlapOSMixin: Move part of this mixin into portal_components to speed up development.

  Include SlapOSTestCaseMixin on portal_components and update the tests to use
  it instead directly use SlapOSMixin from SlapOS Product
parent adea5daf
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
import transaction import transaction
from functools import wraps from functools import wraps
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin, withAbort
testSlapOSMixin, withAbort
import os import os
import tempfile import tempfile
from DateTime import DateTime from DateTime import DateTime
...@@ -83,7 +83,7 @@ if context.getTitle() == 'Not visited by %s': ...@@ -83,7 +83,7 @@ if context.getTitle() == 'Not visited by %s':
return wrapped return wrapped
return wrapper return wrapper
class TestInstanceInvoicingAlarm(testSlapOSMixin): class TestInstanceInvoicingAlarm(SlapOSTestCaseMixin):
@withAbort @withAbort
def test_noSaleOrderPackingList_newSoftwareInstance(self): def test_noSaleOrderPackingList_newSoftwareInstance(self):
""" """
...@@ -275,7 +275,7 @@ class TestInstanceInvoicingAlarm(testSlapOSMixin): ...@@ -275,7 +275,7 @@ class TestInstanceInvoicingAlarm(testSlapOSMixin):
self.assertEqual(2, instance.getInvoicingSynchronizationPointer()) self.assertEqual(2, instance.getInvoicingSynchronizationPointer())
delivery = instance.getCausalityValue() delivery = instance.getCausalityValue()
setup_line, update_line, destroy_line =\ setup_line, _, destroy_line =\
self.check_instance_delivery(delivery, start_date, stop_date, person, 2) self.check_instance_delivery(delivery, start_date, stop_date, person, 2)
self.check_instance_movement(setup_line, instance, subscription, 1) self.check_instance_movement(setup_line, instance, subscription, 1)
self.check_instance_movement(destroy_line, instance, subscription, 1) self.check_instance_movement(destroy_line, instance, subscription, 1)
...@@ -347,7 +347,7 @@ class TestInstanceInvoicingAlarm(testSlapOSMixin): ...@@ -347,7 +347,7 @@ class TestInstanceInvoicingAlarm(testSlapOSMixin):
self.assertEqual(2, instance.getInvoicingSynchronizationPointer()) self.assertEqual(2, instance.getInvoicingSynchronizationPointer())
delivery = instance.getCausalityValue() delivery = instance.getCausalityValue()
setup_line, update_line, destroy_line =\ setup_line, update_line, _ =\
self.check_instance_delivery(delivery, start_date, stop_date, person, 1) self.check_instance_delivery(delivery, start_date, stop_date, person, 1)
self.check_instance_movement(setup_line, instance, subscription, 1) self.check_instance_movement(setup_line, instance, subscription, 1)
...@@ -404,7 +404,7 @@ class TestInstanceInvoicingAlarm(testSlapOSMixin): ...@@ -404,7 +404,7 @@ class TestInstanceInvoicingAlarm(testSlapOSMixin):
self.assertEqual(4, instance.getInvoicingSynchronizationPointer()) self.assertEqual(4, instance.getInvoicingSynchronizationPointer())
delivery = instance.getCausalityValue() delivery = instance.getCausalityValue()
setup_line, update_line, destroy_line =\ setup_line, update_line, _ =\
self.check_instance_delivery(delivery, start_date, stop_date, person, 2) self.check_instance_delivery(delivery, start_date, stop_date, person, 2)
self.check_instance_movement(setup_line, instance, subscription, 1) self.check_instance_movement(setup_line, instance, subscription, 1)
self.check_instance_movement(update_line, instance, subscription, 2) self.check_instance_movement(update_line, instance, subscription, 2)
...@@ -525,7 +525,7 @@ class TestInstanceInvoicingAlarm(testSlapOSMixin): ...@@ -525,7 +525,7 @@ class TestInstanceInvoicingAlarm(testSlapOSMixin):
self.assertEqual(4, instance.getInvoicingSynchronizationPointer()) self.assertEqual(4, instance.getInvoicingSynchronizationPointer())
delivery = instance.getCausalityValue() delivery = instance.getCausalityValue()
setup_line, update_line, destroy_line =\ _, update_line, destroy_line =\
self.check_instance_delivery(delivery, start_date, stop_date, person, 1) self.check_instance_delivery(delivery, start_date, stop_date, person, 1)
self.check_instance_movement(update_line, instance, subscription, 2) self.check_instance_movement(update_line, instance, subscription, 2)
...@@ -646,7 +646,7 @@ class TestInstanceInvoicingAlarm(testSlapOSMixin): ...@@ -646,7 +646,7 @@ class TestInstanceInvoicingAlarm(testSlapOSMixin):
self.assertEqual(4, instance.getInvoicingSynchronizationPointer()) self.assertEqual(4, instance.getInvoicingSynchronizationPointer())
delivery = instance.getCausalityValue() delivery = instance.getCausalityValue()
setup_line, update_line, destroy_line =\ setup_line, update_line, _ =\
self.check_instance_delivery(delivery, start_date, stop_date, person, 1) self.check_instance_delivery(delivery, start_date, stop_date, person, 1)
self.check_instance_movement(update_line, instance, subscription, 2) self.check_instance_movement(update_line, instance, subscription, 2)
...@@ -689,7 +689,7 @@ class TestInstanceInvoicingAlarm(testSlapOSMixin): ...@@ -689,7 +689,7 @@ class TestInstanceInvoicingAlarm(testSlapOSMixin):
self.check_instance_delivery(delivery, stop_date, stop_date, person, 1) self.check_instance_delivery(delivery, stop_date, stop_date, person, 1)
self.check_instance_movement(update_line, instance, subscription, 1) self.check_instance_movement(update_line, instance, subscription, 1)
class TestOpenSaleOrderAlarm(testSlapOSMixin): class TestOpenSaleOrderAlarm(SlapOSTestCaseMixin):
def test_noOSO_newPerson(self): def test_noOSO_newPerson(self):
person = self.portal.person_module.template_member\ person = self.portal.person_module.template_member\
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
...@@ -743,7 +743,7 @@ class TestOpenSaleOrderAlarm(testSlapOSMixin): ...@@ -743,7 +743,7 @@ class TestOpenSaleOrderAlarm(testSlapOSMixin):
'Visited by HostingSubscription_requestUpdateOpenSaleOrder', 'Visited by HostingSubscription_requestUpdateOpenSaleOrder',
subscription.workflow_history['edit_workflow'][-1]['comment']) subscription.workflow_history['edit_workflow'][-1]['comment'])
class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin): class TestHostingSubscription_requestUpdateOpenSaleOrder(SlapOSTestCaseMixin):
def test_REQUEST_disallowed(self): def test_REQUEST_disallowed(self):
subscription = self.portal.hosting_subscription_module\ subscription = self.portal.hosting_subscription_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1) .template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
...@@ -1291,7 +1291,7 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin): ...@@ -1291,7 +1291,7 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin):
self.assertTrue(new_effective_date > effective_date, self.assertTrue(new_effective_date > effective_date,
"%s <= %s" % (new_effective_date, effective_date)) "%s <= %s" % (new_effective_date, effective_date))
class TestSlapOSTriggerBuildAlarm(testSlapOSMixin): class TestSlapOSTriggerBuildAlarm(SlapOSTestCaseMixin):
@simulateByTitlewMark('SimulationMovement_buildSlapOS') @simulateByTitlewMark('SimulationMovement_buildSlapOS')
def test_SimulationMovement_withoutDelivery(self): def test_SimulationMovement_withoutDelivery(self):
applied_rule = self.portal.portal_simulation.newContent( applied_rule = self.portal.portal_simulation.newContent(
...@@ -1332,7 +1332,7 @@ class TestSlapOSTriggerBuildAlarm(testSlapOSMixin): ...@@ -1332,7 +1332,7 @@ class TestSlapOSTriggerBuildAlarm(testSlapOSMixin):
def test_SimulationMovement_buildSlapOS(self): def test_SimulationMovement_buildSlapOS(self):
build_simulator = tempfile.mkstemp()[1] build_simulator = tempfile.mkstemp()[1]
activate_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(
...@@ -1415,7 +1415,7 @@ class TestSlapOSTriggerBuildAlarm(testSlapOSMixin): ...@@ -1415,7 +1415,7 @@ class TestSlapOSTriggerBuildAlarm(testSlapOSMixin):
def test_SimulationMovement_buildSlapOS_withDelivery(self): def test_SimulationMovement_buildSlapOS_withDelivery(self):
build_simulator = tempfile.mkstemp()[1] build_simulator = tempfile.mkstemp()[1]
activate_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')
...@@ -1475,7 +1475,7 @@ class TestSlapOSTriggerBuildAlarm(testSlapOSMixin): ...@@ -1475,7 +1475,7 @@ class TestSlapOSTriggerBuildAlarm(testSlapOSMixin):
if os.path.exists(activate_simulator): if os.path.exists(activate_simulator):
os.unlink(activate_simulator) os.unlink(activate_simulator)
class TestSlapOSManageBuildingCalculatingDeliveryAlarm(testSlapOSMixin): class TestSlapOSManageBuildingCalculatingDeliveryAlarm(SlapOSTestCaseMixin):
@simulateByTitlewMark('Delivery_manageBuildingCalculatingDelivery') @simulateByTitlewMark('Delivery_manageBuildingCalculatingDelivery')
def _test(self, state, message): def _test(self, state, message):
delivery = self.portal.sale_packing_list_module.newContent( delivery = self.portal.sale_packing_list_module.newContent(
...@@ -1506,7 +1506,7 @@ class TestSlapOSManageBuildingCalculatingDeliveryAlarm(testSlapOSMixin): ...@@ -1506,7 +1506,7 @@ class TestSlapOSManageBuildingCalculatingDeliveryAlarm(testSlapOSMixin):
def _test_Delivery_manageBuildingCalculatingDelivery(self, state, empty=False): def _test_Delivery_manageBuildingCalculatingDelivery(self, state, empty=False):
updateCausalityState_simulator = tempfile.mkstemp()[1] updateCausalityState_simulator = tempfile.mkstemp()[1]
updateSimulation_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')
...@@ -1656,7 +1656,7 @@ class TestSlapOSConfirmedDeliveryMixin: ...@@ -1656,7 +1656,7 @@ class TestSlapOSConfirmedDeliveryMixin:
'confirmed', True) 'confirmed', True)
class TestSlapOSStartConfirmedAggregatedSalePackingListAlarm( class TestSlapOSStartConfirmedAggregatedSalePackingListAlarm(
testSlapOSMixin, TestSlapOSConfirmedDeliveryMixin): SlapOSTestCaseMixin, TestSlapOSConfirmedDeliveryMixin):
destination_state = 'started' destination_state = 'started'
script = 'Delivery_startConfirmedAggregatedSalePackingList' script = 'Delivery_startConfirmedAggregatedSalePackingList'
portal_type = 'Sale Packing List' portal_type = 'Sale Packing List'
...@@ -1692,7 +1692,7 @@ class TestSlapOSStartConfirmedAggregatedSalePackingListAlarm( ...@@ -1692,7 +1692,7 @@ class TestSlapOSStartConfirmedAggregatedSalePackingListAlarm(
destination_decision='organisation_module/slapos', destination_decision='organisation_module/slapos',
price_currency='currency_module/EUR', price_currency='currency_module/EUR',
) )
movement = delivery.newContent( delivery.newContent(
portal_type="Sale Packing List Line", portal_type="Sale Packing List Line",
resource='service_module/slapos_instance_setup', resource='service_module/slapos_instance_setup',
quantity=0, quantity=0,
...@@ -1708,7 +1708,7 @@ class TestSlapOSStartConfirmedAggregatedSalePackingListAlarm( ...@@ -1708,7 +1708,7 @@ class TestSlapOSStartConfirmedAggregatedSalePackingListAlarm(
self.assertEquals(delivery.getSimulationState(), 'started') self.assertEquals(delivery.getSimulationState(), 'started')
class TestSlapOSDeliverStartedAggregatedSalePackingListAlarm( class TestSlapOSDeliverStartedAggregatedSalePackingListAlarm(
testSlapOSMixin): SlapOSTestCaseMixin):
destination_state = 'delivered' destination_state = 'delivered'
script = 'Delivery_deliverStartedAggregatedSalePackingList' script = 'Delivery_deliverStartedAggregatedSalePackingList'
portal_type = 'Sale Packing List' portal_type = 'Sale Packing List'
...@@ -1805,13 +1805,13 @@ class TestSlapOSDeliverStartedAggregatedSalePackingListAlarm( ...@@ -1805,13 +1805,13 @@ class TestSlapOSDeliverStartedAggregatedSalePackingListAlarm(
'started', True) 'started', True)
class TestSlapOSStopConfirmedAggregatedSaleInvoiceTransactionAlarm( class TestSlapOSStopConfirmedAggregatedSaleInvoiceTransactionAlarm(
testSlapOSMixin, TestSlapOSConfirmedDeliveryMixin): SlapOSTestCaseMixin, TestSlapOSConfirmedDeliveryMixin):
destination_state = 'stopped' destination_state = 'stopped'
script = 'Delivery_stopConfirmedAggregatedSaleInvoiceTransaction' script = 'Delivery_stopConfirmedAggregatedSaleInvoiceTransaction'
portal_type = 'Sale Invoice Transaction' portal_type = 'Sale Invoice Transaction'
alarm = 'slapos_stop_confirmed_aggregated_sale_invoice_transaction' alarm = 'slapos_stop_confirmed_aggregated_sale_invoice_transaction'
class TestSlapOSUpdateOpenSaleOrderPeriod(testSlapOSMixin): class TestSlapOSUpdateOpenSaleOrderPeriod(SlapOSTestCaseMixin):
def createOpenOrder(self): def createOpenOrder(self):
open_order = self.portal.open_sale_order_module\ open_order = self.portal.open_sale_order_module\
...@@ -1947,7 +1947,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by O ...@@ -1947,7 +1947,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by O
'Visited by OpenSaleOrder_updatePeriod', 'Visited by OpenSaleOrder_updatePeriod',
open_order.workflow_history['edit_workflow'][-1]['comment']) open_order.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSReindexOpenSaleOrder(testSlapOSMixin): class TestSlapOSReindexOpenSaleOrder(SlapOSTestCaseMixin):
def createOpenOrder(self): def createOpenOrder(self):
open_order = self.portal.open_sale_order_module\ open_order = self.portal.open_sale_order_module\
...@@ -2004,7 +2004,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by O ...@@ -2004,7 +2004,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by O
'Visited by OpenSaleOrder_reindexIfIndexedBeforeLine', 'Visited by OpenSaleOrder_reindexIfIndexedBeforeLine',
open_order.workflow_history['edit_workflow'][-1]['comment']) open_order.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSGeneratePackingListFromTioXML(testSlapOSMixin): class TestSlapOSGeneratePackingListFromTioXML(SlapOSTestCaseMixin):
def createTioXMLFile(self): def createTioXMLFile(self):
document = self.portal.consumption_document_module.newContent( document = self.portal.consumption_document_module.newContent(
......
...@@ -47,14 +47,9 @@ ...@@ -47,14 +47,9 @@
<value> <value>
<tuple> <tuple>
<string>W: 30, 10: Use of eval (eval-used)</string> <string>W: 30, 10: Use of eval (eval-used)</string>
<string>W:278, 16: Unused variable \'update_line\' (unused-variable)</string>
<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:528, 20: Unused variable \'destroy_line\' (unused-variable)</string>
<string>W:407, 29: Unused variable \'destroy_line\' (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: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:649, 4: Unused variable \'setup_line\' (unused-variable)</string>
<string>W:688, 29: Unused variable \'destroy_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:688, 4: Unused variable \'setup_line\' (unused-variable)</string>
...@@ -68,7 +63,6 @@ ...@@ -68,7 +63,6 @@
<string>W:1463, 23: 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:1526, 35: Use of eval (eval-used)</string>
<string>W:1527, 31: 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> </tuple>
</value> </value>
</item> </item>
......
...@@ -5,15 +5,13 @@ ...@@ -5,15 +5,13 @@
# #
############################################################################## ##############################################################################
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
testSlapOSMixin
from DateTime import DateTime from DateTime import DateTime
import transaction
def convertCategoryList(base, l): def convertCategoryList(base, l):
return ['%s/%s' % (base, q) for q in l] return ['%s/%s' % (base, q) for q in l]
class TestSlapOSSalePackingListBuilder(testSlapOSMixin): class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
def checkSimulationMovement(self, simulation_movement): def checkSimulationMovement(self, simulation_movement):
self.assertEqual(1.0, simulation_movement.getDeliveryRatio()) self.assertEqual(1.0, simulation_movement.getDeliveryRatio())
self.assertEqual(0.0, simulation_movement.getDeliveryError()) self.assertEqual(0.0, simulation_movement.getDeliveryError())
...@@ -1210,7 +1208,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis ...@@ -1210,7 +1208,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
self.assertEqual(invoice_2.getRelativeUrl(), self.assertEqual(invoice_2.getRelativeUrl(),
model_line_2_tax_bis.getParentValue().getRelativeUrl()) model_line_2_tax_bis.getParentValue().getRelativeUrl())
class TestSlapOSAggregatedDeliveryBuilder(testSlapOSMixin): class TestSlapOSAggregatedDeliveryBuilder(SlapOSTestCaseMixin):
def emptyBuild(self, **kw): def emptyBuild(self, **kw):
delivery_list = self._build(**kw) delivery_list = self._build(**kw)
self.assertSameSet([], delivery_list) self.assertSameSet([], delivery_list)
......
...@@ -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>testSlapOSAccountingBuilder</string> </value> <value> <string>testSlapOSAccountingBuilder</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.testSlapOSAccountingBuilder</string> </value> <value> <string>test.erp5.testSlapOSAccountingBuilder</string> </value>
...@@ -33,9 +45,7 @@ ...@@ -33,9 +45,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 11, 0: Unused import transaction (unused-import)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -45,13 +55,28 @@ ...@@ -45,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>
...@@ -64,7 +89,7 @@ ...@@ -64,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>
...@@ -73,7 +98,7 @@ ...@@ -73,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>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
############################################################################## ##############################################################################
from erp5.component.test.testSlapOSCloudConstraint import TestSlapOSConstraintMixin from erp5.component.test.testSlapOSCloudConstraint import TestSlapOSConstraintMixin
from Products.ERP5Type.Base import WorkflowMethod from Products.ERP5Type.Base import WorkflowMethod
from Products.SlapOS.tests.testSlapOSMixin import withAbort from erp5.component.test.SlapOSTestCaseMixin import withAbort
from unittest import skip from unittest import skip
import transaction import transaction
......
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
testSlapOSMixin
import transaction import transaction
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.DateUtils import addToDate
class TestSlapOSAccountingInteractionWorkflow(testSlapOSMixin): class TestSlapOSAccountingInteractionWorkflow(SlapOSTestCaseMixin):
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
......
...@@ -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>testSlapOSAccountingInteractionWorkflow</string> </value> <value> <string>testSlapOSAccountingInteractionWorkflow</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.testSlapOSAccountingInteractionWorkflow</string> </value> <value> <string>test.erp5.testSlapOSAccountingInteractionWorkflow</string> </value>
...@@ -33,9 +45,7 @@ ...@@ -33,9 +45,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 7, 0: Unused import addToDate (unused-import)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -45,13 +55,28 @@ ...@@ -45,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>
...@@ -64,7 +89,7 @@ ...@@ -64,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>
...@@ -73,7 +98,7 @@ ...@@ -73,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>
......
...@@ -4,9 +4,8 @@ ...@@ -4,9 +4,8 @@
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
# #
############################################################################## ##############################################################################
from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin, withAbort
from Products.SlapOS.tests.testSlapOSMixin import \
testSlapOSMixin, withAbort
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.DateUtils import addToDate from Products.ERP5Type.DateUtils import addToDate
from Products.ERP5.Document.SimulationMovement import SimulationMovement from Products.ERP5.Document.SimulationMovement import SimulationMovement
...@@ -17,9 +16,9 @@ def getSimulationStatePlanned(self, *args, **kwargs): ...@@ -17,9 +16,9 @@ def getSimulationStatePlanned(self, *args, **kwargs):
def getSimulationStateDelivered(self, *args, **kwargs): def getSimulationStateDelivered(self, *args, **kwargs):
if self.getId() == 'root_simulation_movement' or \ if self.getId() == 'root_simulation_movement' or \
self.getParentValue().getParentValue().getId() == \ self.getParentValue().getParentValue().getId() == \
'root_simulation_movement': 'root_simulation_movement':
return 'delivered' return 'delivered'
return 'planned' return 'planned'
def getSimulationStatePlannedDelivered(self, *args, **kwargs): def getSimulationStatePlannedDelivered(self, *args, **kwargs):
...@@ -27,7 +26,7 @@ def getSimulationStatePlannedDelivered(self, *args, **kwargs): ...@@ -27,7 +26,7 @@ def getSimulationStatePlannedDelivered(self, *args, **kwargs):
return 'delivered' return 'delivered'
return 'planned' return 'planned'
class TestDefaultInvoiceTransactionRule(testSlapOSMixin): class TestDefaultInvoiceTransactionRule(SlapOSTestCaseMixin):
@withAbort @withAbort
def test_simulation(self): def test_simulation(self):
SimulationMovement.original_getSimulationState = SimulationMovement\ SimulationMovement.original_getSimulationState = SimulationMovement\
...@@ -159,7 +158,7 @@ class TestDefaultInvoiceTransactionRule(testSlapOSMixin): ...@@ -159,7 +158,7 @@ class TestDefaultInvoiceTransactionRule(testSlapOSMixin):
.original_getSimulationState .original_getSimulationState
class TestDefaultInvoiceRule(testSlapOSMixin): class TestDefaultInvoiceRule(SlapOSTestCaseMixin):
@withAbort @withAbort
def test_simulation(self): def test_simulation(self):
SimulationMovement.original_getSimulationState = SimulationMovement\ SimulationMovement.original_getSimulationState = SimulationMovement\
...@@ -233,7 +232,7 @@ class TestDefaultInvoiceRule(testSlapOSMixin): ...@@ -233,7 +232,7 @@ class TestDefaultInvoiceRule(testSlapOSMixin):
.original_getSimulationState .original_getSimulationState
class TestDefaultInvoicingRule(testSlapOSMixin): class TestDefaultInvoicingRule(SlapOSTestCaseMixin):
@withAbort @withAbort
def test_simulation(self): def test_simulation(self):
SimulationMovement.original_getSimulationState = SimulationMovement\ SimulationMovement.original_getSimulationState = SimulationMovement\
...@@ -353,7 +352,7 @@ class TestDefaultInvoicingRule(testSlapOSMixin): ...@@ -353,7 +352,7 @@ class TestDefaultInvoicingRule(testSlapOSMixin):
SimulationMovement.getSimulationState = SimulationMovement\ SimulationMovement.getSimulationState = SimulationMovement\
.original_getSimulationState .original_getSimulationState
class TestDefaultPaymentRule(testSlapOSMixin): class TestDefaultPaymentRule(SlapOSTestCaseMixin):
@withAbort @withAbort
def test_simulation(self): def test_simulation(self):
SimulationMovement.original_getSimulationState = SimulationMovement\ SimulationMovement.original_getSimulationState = SimulationMovement\
...@@ -418,7 +417,7 @@ class TestDefaultPaymentRule(testSlapOSMixin): ...@@ -418,7 +417,7 @@ class TestDefaultPaymentRule(testSlapOSMixin):
SimulationMovement.getSimulationState = SimulationMovement\ SimulationMovement.getSimulationState = SimulationMovement\
.original_getSimulationState .original_getSimulationState
class TestHostingSubscriptionSimulation(testSlapOSMixin): class TestHostingSubscriptionSimulation(SlapOSTestCaseMixin):
def _prepare(self): def _prepare(self):
person = self.portal.person_module.template_member\ person = self.portal.person_module.template_member\
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
...@@ -666,7 +665,7 @@ class TestHostingSubscriptionSimulation(testSlapOSMixin): ...@@ -666,7 +665,7 @@ class TestHostingSubscriptionSimulation(testSlapOSMixin):
SimulationMovement.isFrozen = SimulationMovement.originalIsFrozen SimulationMovement.isFrozen = SimulationMovement.originalIsFrozen
delattr(SimulationMovement, 'originalIsFrozen') delattr(SimulationMovement, 'originalIsFrozen')
class TestDefaultTradeModelRule(testSlapOSMixin): class TestDefaultTradeModelRule(SlapOSTestCaseMixin):
@withAbort @withAbort
def test_simulation(self): def test_simulation(self):
SimulationMovement.original_getSimulationState = SimulationMovement\ SimulationMovement.original_getSimulationState = SimulationMovement\
...@@ -779,7 +778,7 @@ class TestDefaultTradeModelRule(testSlapOSMixin): ...@@ -779,7 +778,7 @@ class TestDefaultTradeModelRule(testSlapOSMixin):
SimulationMovement.getSimulationState = SimulationMovement\ SimulationMovement.getSimulationState = SimulationMovement\
.original_getSimulationState .original_getSimulationState
class TestDefaultDeliveryRule(testSlapOSMixin): class TestDefaultDeliveryRule(SlapOSTestCaseMixin):
trade_condition = 'sale_trade_condition_module/slapos_aggregated_trade_condition' trade_condition = 'sale_trade_condition_module/slapos_aggregated_trade_condition'
def test(self): def test(self):
def newArrow(): def newArrow():
...@@ -867,7 +866,7 @@ class TestDefaultDeliveryRule(testSlapOSMixin): ...@@ -867,7 +866,7 @@ class TestDefaultDeliveryRule(testSlapOSMixin):
self.assertSameSet(['default_invoicing_rule'], [q.getSpecialiseReference() self.assertSameSet(['default_invoicing_rule'], [q.getSpecialiseReference()
for q in simulation_movement.contentValues(portal_type='Applied Rule')]) for q in simulation_movement.contentValues(portal_type='Applied Rule')])
class TestDefaultDeliveryRuleConsumption(testSlapOSMixin): class TestDefaultDeliveryRuleConsumption(SlapOSTestCaseMixin):
def test(self): def test(self):
def newArrow(): def newArrow():
return self.portal.organisation_module.newContent( return self.portal.organisation_module.newContent(
...@@ -907,6 +906,6 @@ class TestDefaultDeliveryRuleConsumption(testSlapOSMixin): ...@@ -907,6 +906,6 @@ class TestDefaultDeliveryRuleConsumption(testSlapOSMixin):
applied_rule_list = delivery.getCausalityRelatedValueList() applied_rule_list = delivery.getCausalityRelatedValueList()
self.assertEqual(0, len(applied_rule_list)) self.assertEqual(0, len(applied_rule_list))
class TestDefaultDeliveryRuleSubscription(testSlapOSMixin): class TestDefaultDeliveryRuleSubscription(SlapOSTestCaseMixin):
trade_condition = 'sale_trade_condition_module/slapos_subscr'\ trade_condition = 'sale_trade_condition_module/slapos_subscr'\
'iption_trade_condition' 'iption_trade_condition'
...@@ -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>testSlapOSAccountingRule</string> </value> <value> <string>testSlapOSAccountingRule</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.testSlapOSAccountingRule</string> </value> <value> <string>test.erp5.testSlapOSAccountingRule</string> </value>
...@@ -33,9 +45,7 @@ ...@@ -33,9 +45,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 22, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -45,13 +55,28 @@ ...@@ -45,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>
...@@ -64,7 +89,7 @@ ...@@ -64,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>
...@@ -73,7 +98,7 @@ ...@@ -73,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>
......
...@@ -4,14 +4,13 @@ ...@@ -4,14 +4,13 @@
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
# #
############################################################################## ##############################################################################
from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin, withAbort
from Products.SlapOS.tests.testSlapOSMixin import \
testSlapOSMixin, withAbort
from zExceptions import Unauthorized from zExceptions import Unauthorized
from DateTime import DateTime from DateTime import DateTime
import time import time
class TestSlapOSAccounting(testSlapOSMixin): class TestSlapOSAccounting(SlapOSTestCaseMixin):
def createHostingSubscription(self): def createHostingSubscription(self):
new_id = self.generateNewId() new_id = self.generateNewId()
......
...@@ -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>testSlapOSAccountingSkins</string> </value> <value> <string>testSlapOSAccountingSkins</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.testSlapOSAccountingSkins</string> </value> <value> <string>test.erp5.testSlapOSAccountingSkins</string> </value>
...@@ -34,7 +46,7 @@ ...@@ -34,7 +46,7 @@
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple>
<string>W:174, 4: Unused variable \'line\' (unused-variable)</string> <string>W:173, 4: Unused variable \'line\' (unused-variable)</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -45,13 +57,28 @@ ...@@ -45,13 +57,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>
...@@ -64,7 +91,7 @@ ...@@ -64,7 +91,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>
...@@ -73,7 +100,7 @@ ...@@ -73,7 +100,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>
......
...@@ -6,14 +6,11 @@ ...@@ -6,14 +6,11 @@
############################################################################## ##############################################################################
import transaction import transaction
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import \
testSlapOSMixin, withAbort, simulate SlapOSTestCaseMixinWithAbort, SlapOSTestCaseMixin, simulate
from zExceptions import Unauthorized from zExceptions import Unauthorized
class TestSlapOSComputer_reportComputerConsumption(testSlapOSMixin): class TestSlapOSComputer_reportComputerConsumption(SlapOSTestCaseMixinWithAbort):
def beforeTearDown(self):
transaction.abort()
def createComputer(self): def createComputer(self):
new_id = self.generateNewId() new_id = self.generateNewId()
...@@ -128,10 +125,7 @@ class TestSlapOSComputer_reportComputerConsumption(testSlapOSMixin): ...@@ -128,10 +125,7 @@ class TestSlapOSComputer_reportComputerConsumption(testSlapOSMixin):
self.assertEquals(document2.getValidationState(), "submitted") self.assertEquals(document2.getValidationState(), "submitted")
self.assertEquals(document2.getContributor(), computer.getRelativeUrl()) self.assertEquals(document2.getContributor(), computer.getRelativeUrl())
class TestSlapOSComputerConsumptionTioXMLFile_parseXml(testSlapOSMixin): class TestSlapOSComputerConsumptionTioXMLFile_parseXml(SlapOSTestCaseMixinWithAbort):
def beforeTearDown(self):
transaction.abort()
def createTioXMLFile(self): def createTioXMLFile(self):
document = self.portal.consumption_document_module.newContent( document = self.portal.consumption_document_module.newContent(
...@@ -261,7 +255,7 @@ class TestSlapOSComputerConsumptionTioXMLFile_parseXml(testSlapOSMixin): ...@@ -261,7 +255,7 @@ class TestSlapOSComputerConsumptionTioXMLFile_parseXml(testSlapOSMixin):
}) })
class TestSlapOSComputerConsumptionTioXMLFile_solveInvoicingGeneration( class TestSlapOSComputerConsumptionTioXMLFile_solveInvoicingGeneration(
testSlapOSMixin): SlapOSTestCaseMixin):
def createTioXMLFile(self): def createTioXMLFile(self):
document = self.portal.consumption_document_module.newContent( document = self.portal.consumption_document_module.newContent(
......
...@@ -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>testSlapOSConsumptionSkins</string> </value> <value> <string>testSlapOSConsumptionSkins</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.testSlapOSConsumptionSkins</string> </value> <value> <string>test.erp5.testSlapOSConsumptionSkins</string> </value>
...@@ -33,9 +45,7 @@ ...@@ -33,9 +45,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 9, 0: Unused import withAbort (unused-import)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -45,13 +55,28 @@ ...@@ -45,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>
...@@ -64,7 +89,7 @@ ...@@ -64,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>
...@@ -73,7 +98,7 @@ ...@@ -73,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>
......
# Copyright (c) 2013 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2013 Nexedi SA and Contributors. All Rights Reserved.
import transaction import transaction
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
testSlapOSMixin
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
class TestSlapOSRequestValidationPayment(testSlapOSMixin): class TestSlapOSRequestValidationPayment(SlapOSTestCaseMixin):
def _makeSlaveTree(self, requested_template_id='template_slave_instance'): def _makeSlaveTree(self, requested_template_id='template_slave_instance'):
super(TestSlapOSRequestValidationPayment, self).\ SlapOSTestCaseMixin.\
_makeTree(requested_template_id=requested_template_id) _makeTree(self, requested_template_id=requested_template_id)
def _simulateSoftwareInstance_requestValidationPayment(self): def _simulateSoftwareInstance_requestValidationPayment(self):
script_name = 'SoftwareInstance_requestValidationPayment' script_name = 'SoftwareInstance_requestValidationPayment'
......
...@@ -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>testSlapOSContractAlarm</string> </value> <value> <string>testSlapOSContractAlarm</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.testSlapOSContractAlarm</string> </value> <value> <string>test.erp5.testSlapOSContractAlarm</string> </value>
...@@ -43,13 +55,28 @@ ...@@ -43,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>
...@@ -62,7 +89,7 @@ ...@@ -62,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>
...@@ -71,7 +98,7 @@ ...@@ -71,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>
......
# Copyright (c) 2013 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2013 Nexedi SA and Contributors. All Rights Reserved.
import transaction from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixinWithAbort
from Products.SlapOS.tests.testSlapOSMixin import \
testSlapOSMixin
from zExceptions import Unauthorized from zExceptions import Unauthorized
from DateTime import DateTime from DateTime import DateTime
from functools import wraps
from Products.ERP5Type.tests.utils import createZODBPythonScript
import difflib
class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin):
def beforeTearDown(self): class TestSlapOSSoftwareInstance_requestValidationPayment(SlapOSTestCaseMixinWithAbort):
transaction.abort()
def createCloudContract(self): def createCloudContract(self):
new_id = self.generateNewId() new_id = self.generateNewId()
...@@ -62,23 +55,23 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin): ...@@ -62,23 +55,23 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin):
return person, instance, subscription return person, instance, subscription
def test_requestValidationPayment_REQUEST_disallowed(self): def test_requestValidationPayment_REQUEST_disallowed(self):
person, instance, subscription = self.createNeededDocuments() _, instance, _ = self.createNeededDocuments()
self.assertRaises( self.assertRaises(
Unauthorized, Unauthorized,
instance.SoftwareInstance_requestValidationPayment, instance.SoftwareInstance_requestValidationPayment,
REQUEST={}) REQUEST={})
def test_prevent_concurrency(self): def test_prevent_concurrency(self):
person, instance, subscription = self.createNeededDocuments() person, instance, _ = self.createNeededDocuments()
tag = "%s_requestValidationPayment_inProgress" % person.getUid() tag = "%s_requestValidationPayment_inProgress" % person.getUid()
person.reindexObject(activate_kw={'tag': tag}) person.reindexObject(activate_kw={'tag': tag})
transaction.commit() self.commit()
result = instance.SoftwareInstance_requestValidationPayment() result = instance.SoftwareInstance_requestValidationPayment()
self.assertEquals(result, None) self.assertEquals(result, None)
def test_addCloudContract(self): def test_addCloudContract(self):
person, instance, subscription = self.createNeededDocuments() person, instance, _ = self.createNeededDocuments()
contract = instance.SoftwareInstance_requestValidationPayment() contract = instance.SoftwareInstance_requestValidationPayment()
# Default property # Default property
...@@ -89,34 +82,34 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin): ...@@ -89,34 +82,34 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin):
'Contract for "%s"' % person.getTitle()) 'Contract for "%s"' % person.getTitle())
def test_addCloudContract_do_not_duplicate_contract_if_not_reindexed(self): def test_addCloudContract_do_not_duplicate_contract_if_not_reindexed(self):
person, instance, subscription = self.createNeededDocuments() _, instance, _ = self.createNeededDocuments()
contract = instance.SoftwareInstance_requestValidationPayment() contract = instance.SoftwareInstance_requestValidationPayment()
transaction.commit() self.commit()
contract2 = instance.SoftwareInstance_requestValidationPayment() contract2 = instance.SoftwareInstance_requestValidationPayment()
self.assertNotEquals(contract, None) self.assertNotEquals(contract, None)
self.assertEquals(contract2, None) self.assertEquals(contract2, None)
def test_addCloudContract_existing_invalidated_contract(self): def test_addCloudContract_existing_invalidated_contract(self):
person, instance, subscription = self.createNeededDocuments() _, instance, _ = self.createNeededDocuments()
contract = instance.SoftwareInstance_requestValidationPayment() contract = instance.SoftwareInstance_requestValidationPayment()
transaction.commit() self.commit()
self.tic() self.tic()
contract2 = instance.SoftwareInstance_requestValidationPayment() contract2 = instance.SoftwareInstance_requestValidationPayment()
self.assertNotEquals(contract, None) self.assertNotEquals(contract, None)
self.assertEquals(contract2.getRelativeUrl(), contract.getRelativeUrl()) self.assertEquals(contract2.getRelativeUrl(), contract.getRelativeUrl())
def test_addCloudContract_existing_validated_contract(self): def test_addCloudContract_existing_validated_contract(self):
person, instance, subscription = self.createNeededDocuments() _, instance, _ = self.createNeededDocuments()
contract = instance.SoftwareInstance_requestValidationPayment() contract = instance.SoftwareInstance_requestValidationPayment()
contract.validate() contract.validate()
transaction.commit() self.commit()
self.tic() self.tic()
contract2 = instance.SoftwareInstance_requestValidationPayment() contract2 = instance.SoftwareInstance_requestValidationPayment()
self.assertNotEquals(contract, None) self.assertNotEquals(contract, None)
self.assertEquals(contract2.getRelativeUrl(), contract.getRelativeUrl()) self.assertEquals(contract2.getRelativeUrl(), contract.getRelativeUrl())
def test_do_nothing_if_validated_contract(self): def test_do_nothing_if_validated_contract(self):
person, instance, subscription = self.createNeededDocuments() person, instance, _ = self.createNeededDocuments()
contract = self.createCloudContract() contract = self.createCloudContract()
contract.edit(destination_section_value=person) contract.edit(destination_section_value=person)
contract.validate() contract.validate()
...@@ -128,7 +121,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin): ...@@ -128,7 +121,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin):
self.assertEquals(contract2.getValidationState(), "validated") self.assertEquals(contract2.getValidationState(), "validated")
def test_validate_contract_if_payment_found(self): def test_validate_contract_if_payment_found(self):
person, instance, subscription = self.createNeededDocuments() person, instance, _ = self.createNeededDocuments()
contract = self.createCloudContract() contract = self.createCloudContract()
contract.edit(destination_section_value=person) contract.edit(destination_section_value=person)
payment = self.createPaymentTransaction() payment = self.createPaymentTransaction()
...@@ -145,7 +138,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin): ...@@ -145,7 +138,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin):
self.assertEquals(contract2.getValidationState(), "validated") self.assertEquals(contract2.getValidationState(), "validated")
def test_create_invoice_if_needed_and_no_payment_found(self): def test_create_invoice_if_needed_and_no_payment_found(self):
person, instance, subscription = self.createNeededDocuments() person, instance, _ = self.createNeededDocuments()
contract = self.createCloudContract() contract = self.createCloudContract()
contract.edit(destination_section_value=person) contract.edit(destination_section_value=person)
self.assertEquals(contract.getValidationState(), "invalidated") self.assertEquals(contract.getValidationState(), "invalidated")
...@@ -173,7 +166,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin): ...@@ -173,7 +166,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin):
self.assertEquals(invoice.getStartDate(), invoice.getStopDate()) self.assertEquals(invoice.getStartDate(), invoice.getStopDate())
def test_do_nothing_if_invoice_is_ongoing(self): def test_do_nothing_if_invoice_is_ongoing(self):
person, instance, subscription = self.createNeededDocuments() person, instance, _ = self.createNeededDocuments()
contract = self.createCloudContract() contract = self.createCloudContract()
invoice = self.createInvoiceTransaction() invoice = self.createInvoiceTransaction()
self.portal.portal_workflow._jumpToStateFor(invoice, 'confirmed') self.portal.portal_workflow._jumpToStateFor(invoice, 'confirmed')
...@@ -190,7 +183,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin): ...@@ -190,7 +183,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin):
self.assertEquals(contract2.getValidationState(), "invalidated") self.assertEquals(contract2.getValidationState(), "invalidated")
def test_forget_current_cancelled_invoice(self): def test_forget_current_cancelled_invoice(self):
person, instance, subscription = self.createNeededDocuments() person, instance, _ = self.createNeededDocuments()
contract = self.createCloudContract() contract = self.createCloudContract()
invoice = self.createInvoiceTransaction() invoice = self.createInvoiceTransaction()
self.portal.portal_workflow._jumpToStateFor(invoice, 'cancelled') self.portal.portal_workflow._jumpToStateFor(invoice, 'cancelled')
...@@ -207,7 +200,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin): ...@@ -207,7 +200,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin):
self.assertEquals(contract2.getValidationState(), "invalidated") self.assertEquals(contract2.getValidationState(), "invalidated")
def test_forget_current_grouped_invoice(self): def test_forget_current_grouped_invoice(self):
person, instance, subscription = self.createNeededDocuments() person, instance, _ = self.createNeededDocuments()
contract = self.createCloudContract() contract = self.createCloudContract()
invoice = self.createInvoiceTransaction() invoice = self.createInvoiceTransaction()
line = invoice.newContent( line = invoice.newContent(
...@@ -230,7 +223,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin): ...@@ -230,7 +223,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin):
self.assertEquals(contract2.getValidationState(), "invalidated") self.assertEquals(contract2.getValidationState(), "invalidated")
def test_do_nothing_if_invoice_is_not_grouped(self): def test_do_nothing_if_invoice_is_not_grouped(self):
person, instance, subscription = self.createNeededDocuments() person, instance, _ = self.createNeededDocuments()
contract = self.createCloudContract() contract = self.createCloudContract()
invoice = self.createInvoiceTransaction() invoice = self.createInvoiceTransaction()
invoice.newContent( invoice.newContent(
...@@ -250,10 +243,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin): ...@@ -250,10 +243,7 @@ class TestSlapOSSoftwareInstance_requestValidationPayment(testSlapOSMixin):
self.assertEquals(contract2.getCausality(""), invoice.getRelativeUrl()) self.assertEquals(contract2.getCausality(""), invoice.getRelativeUrl())
self.assertEquals(contract2.getValidationState(), "invalidated") self.assertEquals(contract2.getValidationState(), "invalidated")
class TestSlapOSPerson_isAllowedToAllocate(testSlapOSMixin): class TestSlapOSPerson_isAllowedToAllocate(SlapOSTestCaseMixinWithAbort):
def beforeTearDown(self):
transaction.abort()
def createPerson(self): def createPerson(self):
new_id = self.generateNewId() new_id = self.generateNewId()
......
...@@ -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>testSlapOSContractSkins</string> </value> <value> <string>testSlapOSContractSkins</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.testSlapOSContractSkins</string> </value> <value> <string>test.erp5.testSlapOSContractSkins</string> </value>
...@@ -33,28 +45,7 @@ ...@@ -33,28 +45,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 65, 4: Unused variable \'person\' (unused-variable)</string>
<string>W: 65, 22: Unused variable \'subscription\' (unused-variable)</string>
<string>W: 72, 22: Unused variable \'subscription\' (unused-variable)</string>
<string>W: 81, 22: Unused variable \'subscription\' (unused-variable)</string>
<string>W: 92, 4: Unused variable \'person\' (unused-variable)</string>
<string>W: 92, 22: Unused variable \'subscription\' (unused-variable)</string>
<string>W:100, 4: Unused variable \'person\' (unused-variable)</string>
<string>W:100, 22: Unused variable \'subscription\' (unused-variable)</string>
<string>W:109, 4: Unused variable \'person\' (unused-variable)</string>
<string>W:109, 22: Unused variable \'subscription\' (unused-variable)</string>
<string>W:119, 22: Unused variable \'subscription\' (unused-variable)</string>
<string>W:131, 22: Unused variable \'subscription\' (unused-variable)</string>
<string>W:148, 22: Unused variable \'subscription\' (unused-variable)</string>
<string>W:176, 22: Unused variable \'subscription\' (unused-variable)</string>
<string>W:193, 22: Unused variable \'subscription\' (unused-variable)</string>
<string>W:210, 22: Unused variable \'subscription\' (unused-variable)</string>
<string>W:233, 22: Unused variable \'subscription\' (unused-variable)</string>
<string>W: 7, 0: Unused import wraps (unused-import)</string>
<string>W: 8, 0: Unused import createZODBPythonScript (unused-import)</string>
<string>W: 9, 0: Unused import difflib (unused-import)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -64,13 +55,28 @@ ...@@ -64,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>
...@@ -83,7 +89,7 @@ ...@@ -83,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>
...@@ -92,7 +98,7 @@ ...@@ -92,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>
......
<?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>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>SlapOSTestCaseMixin</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.SlapOSTestCaseMixin</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>
<string>W:438, 0: Cannot decode using encoding "ascii", unexpected byte at position 32 (invalid-encoded-data)</string>
<string>W:441, 0: Cannot decode using encoding "ascii", unexpected byte at position 17 (invalid-encoded-data)</string>
<string>W:444, 0: Cannot decode using encoding "ascii", unexpected byte at position 18 (invalid-encoded-data)</string>
<string>W:449, 0: Cannot decode using encoding "ascii", unexpected byte at position 13 (invalid-encoded-data)</string>
<string>W:460, 0: Cannot decode using encoding "ascii", unexpected byte at position 14 (invalid-encoded-data)</string>
</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">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>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
<pickle>
<tuple>
<none/>
<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>
</tuple>
</pickle>
</record>
</ZopeData>
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
# #
############################################################################## ##############################################################################
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
testSlapOSMixin
import transaction import transaction
class TestSlapOSConstraintMixin(testSlapOSMixin): class TestSlapOSConstraintMixin(SlapOSTestCaseMixin):
@staticmethod @staticmethod
def getMessageList(o): def getMessageList(o):
return [str(q.getMessage()) for q in o.checkConsistency()] return [str(q.getMessage()) for q in o.checkConsistency()]
......
...@@ -29,11 +29,11 @@ ...@@ -29,11 +29,11 @@
import unittest import unittest
import random import random
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
from Products.SlapOS.tests.testSlapOSMixin import testSlapOSMixin from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
from Products.PluggableAuthService.interfaces.plugins import\ from Products.PluggableAuthService.interfaces.plugins import\
IAuthenticationPlugin IAuthenticationPlugin
class TestSlapOSSecurityMixin(testSlapOSMixin): class TestSlapOSSecurityMixin(SlapOSTestCaseMixin):
def _generateRandomUniqueUserId(self, portal_type, search_key="user_id"): def _generateRandomUniqueUserId(self, portal_type, search_key="user_id"):
user_id = None user_id = None
......
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
testSlapOSMixin
import transaction import transaction
from unittest import expectedFailure from unittest import expectedFailure
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
...@@ -8,10 +7,10 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed ...@@ -8,10 +7,10 @@ from Products.DCWorkflow.DCWorkflow import ValidationFailed
from AccessControl.SecurityManagement import getSecurityManager, \ from AccessControl.SecurityManagement import getSecurityManager, \
setSecurityManager setSecurityManager
class TestSlapOSCoreComputerPartitionSlapInterfaceWorkflow(testSlapOSMixin): class TestSlapOSCoreComputerPartitionSlapInterfaceWorkflow(SlapOSTestCaseMixin):
def afterSetUp(self): def afterSetUp(self):
self.login() self.login()
super(TestSlapOSCoreComputerPartitionSlapInterfaceWorkflow, self).afterSetUp() SlapOSTestCaseMixin.afterSetUp(self)
# Clone computer document # Clone computer document
self.computer = self.portal.computer_module.template_computer\ self.computer = self.portal.computer_module.template_computer\
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
...@@ -100,9 +99,9 @@ class TestSlapOSCoreComputerPartitionSlapInterfaceWorkflow(testSlapOSMixin): ...@@ -100,9 +99,9 @@ class TestSlapOSCoreComputerPartitionSlapInterfaceWorkflow(testSlapOSMixin):
self.assertEqual(1, self.portal.portal_catalog.countResults( self.assertEqual(1, self.portal.portal_catalog.countResults(
parent_uid=self.computer.getUid(), free_for_request=1)[0][0]) parent_uid=self.computer.getUid(), free_for_request=1)[0][0])
class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin): class TestSlapOSCoreComputerSlapInterfaceWorkflow(SlapOSTestCaseMixin):
def afterSetUp(self): def afterSetUp(self):
super(TestSlapOSCoreComputerSlapInterfaceWorkflow, self).afterSetUp() SlapOSTestCaseMixin.afterSetUp(self)
# Clone computer document # Clone computer document
self.computer = self.portal.computer_module.template_computer\ self.computer = self.portal.computer_module.template_computer\
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
...@@ -115,7 +114,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin): ...@@ -115,7 +114,7 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin):
self.tic() self.tic()
def beforeTearDown(self): def beforeTearDown(self):
super(TestSlapOSCoreComputerSlapInterfaceWorkflow, self).beforeTearDown() SlapOSTestCaseMixin.beforeTearDown(self)
self.portal.REQUEST['computer_key'] = None self.portal.REQUEST['computer_key'] = None
self.portal.REQUEST['computer_certificate'] = None self.portal.REQUEST['computer_certificate'] = None
...@@ -367,10 +366,10 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin): ...@@ -367,10 +366,10 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin):
self.assertEqual(None, self.portal.REQUEST.get('computer_certificate')) self.assertEqual(None, self.portal.REQUEST.get('computer_certificate'))
self.assertEqual(None, self.computer.getDestinationReference()) self.assertEqual(None, self.computer.getDestinationReference())
class TestSlapOSCorePersonComputerSupply(testSlapOSMixin): class TestSlapOSCorePersonComputerSupply(SlapOSTestCaseMixin):
def afterSetUp(self): def afterSetUp(self):
super(TestSlapOSCorePersonComputerSupply, self).afterSetUp() SlapOSTestCaseMixin.afterSetUp(self)
portal = self.getPortalObject() portal = self.getPortalObject()
# Clone computer document # Clone computer document
...@@ -674,9 +673,9 @@ class TestSlapOSCorePersonComputerSupply(testSlapOSMixin): ...@@ -674,9 +673,9 @@ class TestSlapOSCorePersonComputerSupply(testSlapOSMixin):
self.assertEqual('SOFTINSTALL-%s' % (previous_id+2), self.assertEqual('SOFTINSTALL-%s' % (previous_id+2),
software_installation.getReference()) software_installation.getReference())
class TestSlapOSCoreInstanceSlapInterfaceWorkflow(testSlapOSMixin): class TestSlapOSCoreInstanceSlapInterfaceWorkflow(SlapOSTestCaseMixin):
def afterSetUp(self): def afterSetUp(self):
super(TestSlapOSCoreInstanceSlapInterfaceWorkflow, self).afterSetUp() SlapOSTestCaseMixin.afterSetUp(self)
hosting_subscription = self.portal.hosting_subscription_module\ hosting_subscription = self.portal.hosting_subscription_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1) .template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
...@@ -1071,11 +1070,11 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(testSlapOSMixin): ...@@ -1071,11 +1070,11 @@ class TestSlapOSCoreInstanceSlapInterfaceWorkflow(testSlapOSMixin):
connection_xml="<foo bar /<>") connection_xml="<foo bar /<>")
transaction.abort() transaction.abort()
class TestSlapOSCoreSoftwareInstanceRequest(testSlapOSMixin): class TestSlapOSCoreSoftwareInstanceRequest(SlapOSTestCaseMixin):
"""Tests instance.requestInstance""" """Tests instance.requestInstance"""
def afterSetUp(self): def afterSetUp(self):
super(TestSlapOSCoreSoftwareInstanceRequest, self).afterSetUp() SlapOSTestCaseMixin.afterSetUp(self)
portal = self.getPortalObject() portal = self.getPortalObject()
new_id = self.generateNewId() new_id = self.generateNewId()
...@@ -1909,10 +1908,10 @@ class TestSlapOSCoreSoftwareInstanceRequest(testSlapOSMixin): ...@@ -1909,10 +1908,10 @@ class TestSlapOSCoreSoftwareInstanceRequest(testSlapOSMixin):
self.assertEqual(bang_amount+1, self._countBang(self.software_instance)) self.assertEqual(bang_amount+1, self._countBang(self.software_instance))
class TestSlapOSCorePersonRequest(testSlapOSMixin): class TestSlapOSCorePersonRequest(SlapOSTestCaseMixin):
def afterSetUp(self): def afterSetUp(self):
super(TestSlapOSCorePersonRequest, self).afterSetUp() SlapOSTestCaseMixin.afterSetUp(self)
person_user = self.makePerson() person_user = self.makePerson()
self.tic() self.tic()
...@@ -2454,13 +2453,13 @@ class TestSlapOSCorePersonRequest(testSlapOSMixin): ...@@ -2454,13 +2453,13 @@ class TestSlapOSCorePersonRequest(testSlapOSMixin):
self.assertNotEquals(hosting_subscription.getRelativeUrl(), self.assertNotEquals(hosting_subscription.getRelativeUrl(),
hosting_subscription2.getRelativeUrl()) hosting_subscription2.getRelativeUrl())
class TestSlapOSCorePersonRequestComputer(testSlapOSMixin): class TestSlapOSCorePersonRequestComputer(SlapOSTestCaseMixin):
def generateNewComputerTitle(self): def generateNewComputerTitle(self):
return 'My Comp %s' % self.generateNewId() return 'My Comp %s' % self.generateNewId()
def afterSetUp(self): def afterSetUp(self):
super(TestSlapOSCorePersonRequestComputer, self).afterSetUp() SlapOSTestCaseMixin.afterSetUp(self)
portal = self.getPortalObject() portal = self.getPortalObject()
person_user = self.makePerson() person_user = self.makePerson()
...@@ -2654,7 +2653,7 @@ class TestSlapOSCorePersonRequestComputer(testSlapOSMixin): ...@@ -2654,7 +2653,7 @@ class TestSlapOSCorePersonRequestComputer(testSlapOSMixin):
self.assertRaises(NotImplementedError, person.requestComputer, self.assertRaises(NotImplementedError, person.requestComputer,
computer_title=computer_title) computer_title=computer_title)
class TestSlapOSCoreSlapOSCloudInteractionWorkflow(testSlapOSMixin): class TestSlapOSCoreSlapOSCloudInteractionWorkflow(SlapOSTestCaseMixin):
def test_Computer_setSubjectList(self): def test_Computer_setSubjectList(self):
self.person_user = self.makePerson() self.person_user = self.makePerson()
......
...@@ -2,4 +2,5 @@ test.erp5.testSlapOSCloudAlarm ...@@ -2,4 +2,5 @@ test.erp5.testSlapOSCloudAlarm
test.erp5.testSlapOSCloudWorkflow test.erp5.testSlapOSCloudWorkflow
test.erp5.testSlapOSCloudSecurityGroup test.erp5.testSlapOSCloudSecurityGroup
test.erp5.testSlapOSCloudConstraint test.erp5.testSlapOSCloudConstraint
test.erp5.testSlapOSCloudShadow test.erp5.testSlapOSCloudShadow
\ No newline at end of file test.erp5.SlapOSTestCaseMixin
\ No newline at end of file
...@@ -5,14 +5,14 @@ ...@@ -5,14 +5,14 @@
# #
############################################################################## ##############################################################################
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import \
testSlapOSMixin SlapOSTestCaseMixin
import os import os
class TestSlapOSConfigurator(testSlapOSMixin): class TestSlapOSConfigurator(SlapOSTestCaseMixin):
def bootstrapSite(self): def bootstrapSite(self):
super(TestSlapOSConfigurator, self).bootstrapSite() SlapOSTestCaseMixin.bootstrapSite(self)
self.getBusinessConfiguration().BusinessConfiguration_invokeSlapOSMasterPromiseAlarmList() self.getBusinessConfiguration().BusinessConfiguration_invokeSlapOSMasterPromiseAlarmList()
self.tic() self.tic()
......
# Copyright (c) 2013 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2013 Nexedi SA and Contributors. All Rights Reserved.
import transaction import transaction
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import \
testSlapOSMixin SlapOSTestCaseMixin
from unittest import skip from unittest import skip
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
class TestSlapOSCRMCreateRegularisationRequest(testSlapOSMixin): class TestSlapOSCRMCreateRegularisationRequest(SlapOSTestCaseMixin):
def _simulatePerson_checkToCreateRegularisationRequest(self): def _simulatePerson_checkToCreateRegularisationRequest(self):
script_name = 'Person_checkToCreateRegularisationRequest' script_name = 'Person_checkToCreateRegularisationRequest'
...@@ -92,7 +92,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P ...@@ -92,7 +92,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
'Visited by Person_checkToCreateRegularisationRequest', 'Visited by Person_checkToCreateRegularisationRequest',
person.workflow_history['edit_workflow'][-1]['comment']) person.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSCrmInvalidateSuspendedRegularisationRequest(testSlapOSMixin): class TestSlapOSCrmInvalidateSuspendedRegularisationRequest(SlapOSTestCaseMixin):
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
...@@ -156,7 +156,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by R ...@@ -156,7 +156,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by R
'Visited by RegularisationRequest_invalidateIfPersonBalanceIsOk', 'Visited by RegularisationRequest_invalidateIfPersonBalanceIsOk',
ticket.workflow_history['edit_workflow'][-1]['comment']) ticket.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSCrmCancelInvoiceRelatedToSuspendedRegularisationRequest(testSlapOSMixin): class TestSlapOSCrmCancelInvoiceRelatedToSuspendedRegularisationRequest(SlapOSTestCaseMixin):
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
...@@ -220,7 +220,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by R ...@@ -220,7 +220,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by R
'Visited by RegularisationRequest_cancelInvoiceIfPersonOpenOrderIsEmpty', 'Visited by RegularisationRequest_cancelInvoiceIfPersonOpenOrderIsEmpty',
ticket.workflow_history['edit_workflow'][-1]['comment']) ticket.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSCrmTriggerEscalationOnAcknowledgmentRegularisationRequest(testSlapOSMixin): class TestSlapOSCrmTriggerEscalationOnAcknowledgmentRegularisationRequest(SlapOSTestCaseMixin):
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
...@@ -303,7 +303,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by R ...@@ -303,7 +303,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by R
'Visited by RegularisationRequest_triggerAcknowledgmentEscalation', 'Visited by RegularisationRequest_triggerAcknowledgmentEscalation',
ticket.workflow_history['edit_workflow'][-1]['comment']) ticket.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSCrmTriggerEscalationOnStopReminderRegularisationRequest(testSlapOSMixin): class TestSlapOSCrmTriggerEscalationOnStopReminderRegularisationRequest(SlapOSTestCaseMixin):
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
...@@ -386,7 +386,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by R ...@@ -386,7 +386,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by R
'Visited by RegularisationRequest_triggerStopReminderEscalation', 'Visited by RegularisationRequest_triggerStopReminderEscalation',
ticket.workflow_history['edit_workflow'][-1]['comment']) ticket.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSCrmTriggerEscalationOnStopAcknowledgmentRegularisationRequest(testSlapOSMixin): class TestSlapOSCrmTriggerEscalationOnStopAcknowledgmentRegularisationRequest(SlapOSTestCaseMixin):
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
...@@ -469,7 +469,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by R ...@@ -469,7 +469,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by R
'Visited by RegularisationRequest_triggerStopAcknowledgmentEscalation', 'Visited by RegularisationRequest_triggerStopAcknowledgmentEscalation',
ticket.workflow_history['edit_workflow'][-1]['comment']) ticket.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSCrmTriggerEscalationOnDeleteReminderRegularisationRequest(testSlapOSMixin): class TestSlapOSCrmTriggerEscalationOnDeleteReminderRegularisationRequest(SlapOSTestCaseMixin):
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
...@@ -552,7 +552,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by R ...@@ -552,7 +552,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by R
'Visited by RegularisationRequest_triggerDeleteReminderEscalation', 'Visited by RegularisationRequest_triggerDeleteReminderEscalation',
ticket.workflow_history['edit_workflow'][-1]['comment']) ticket.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSCrmStopHostingSubscription(testSlapOSMixin): class TestSlapOSCrmStopHostingSubscription(SlapOSTestCaseMixin):
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
...@@ -654,7 +654,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by R ...@@ -654,7 +654,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by R
'Visited by RegularisationRequest_stopHostingSubscriptionList', 'Visited by RegularisationRequest_stopHostingSubscriptionList',
ticket.workflow_history['edit_workflow'][-1]['comment']) ticket.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSCrmDeleteHostingSubscription(testSlapOSMixin): class TestSlapOSCrmDeleteHostingSubscription(SlapOSTestCaseMixin):
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
...@@ -737,9 +737,8 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by R ...@@ -737,9 +737,8 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by R
self.assertNotEqual( self.assertNotEqual(
'Visited by RegularisationRequest_deleteHostingSubscriptionList', 'Visited by RegularisationRequest_deleteHostingSubscriptionList',
ticket.workflow_history['edit_workflow'][-1]['comment']) ticket.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSCrmMonitoringCheckComputerState(testSlapOSMixin): class TestSlapOSCrmMonitoringCheckComputerState(SlapOSTestCaseMixin):
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
...@@ -811,21 +810,21 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C ...@@ -811,21 +810,21 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def test_alarm_check_computer_state_no_public_computer(self): def test_alarm_check_computer_state_no_public_computer(self):
self._test_alarm_check_computer_state_not_selected( self._test_alarm_check_computer_state_not_selected(
allocation_scope='open/personal') allocation_scope='open/personal')
def test_alarm_check_computer_state_closed_forever_computer(self): def test_alarm_check_computer_state_closed_forever_computer(self):
self._test_alarm_check_computer_state_not_selected( self._test_alarm_check_computer_state_not_selected(
allocation_scope='closed/forever') allocation_scope='closed/forever')
def test_alarm_check_computer_state_closed_mantainence_computer(self): def test_alarm_check_computer_state_closed_mantainence_computer(self):
self._test_alarm_check_computer_state_not_selected( self._test_alarm_check_computer_state_not_selected(
allocation_scope='closed/maintenance') allocation_scope='closed/maintenance')
def test_alarm_check_computer_state_closed_termination_computer(self): def test_alarm_check_computer_state_closed_termination_computer(self):
self._test_alarm_check_computer_state_not_selected( self._test_alarm_check_computer_state_not_selected(
allocation_scope='closed/termination') allocation_scope='closed/termination')
class TestSlapOSCrmMonitoringCheckComputerAllocationScope(testSlapOSMixin): class TestSlapOSCrmMonitoringCheckComputerAllocationScope(SlapOSTestCaseMixin):
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
...@@ -896,7 +895,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C ...@@ -896,7 +895,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
def test_alarm_not_allowed_allocationScope_open_personal(self): def test_alarm_not_allowed_allocationScope_open_personal(self):
self._makeComputer() self._makeComputer()
self.computer.edit(allocation_scope = 'open/personal') self.computer.edit(allocation_scope = 'open/personal')
self._simulateComputer_checkAndUpdateAllocationScope() self._simulateComputer_checkAndUpdateAllocationScope()
try: try:
...@@ -909,7 +908,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C ...@@ -909,7 +908,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
self.computer.workflow_history['edit_workflow'][-1]['comment']) self.computer.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSCrmMonitoringCheckComputerPersonalAllocationScope(testSlapOSMixin): class TestSlapOSCrmMonitoringCheckComputerPersonalAllocationScope(SlapOSTestCaseMixin):
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
...@@ -1007,7 +1006,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C ...@@ -1007,7 +1006,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by C
self.assertNotEqual('Visited by Computer_checkAndUpdatePersonalAllocationScope', self.assertNotEqual('Visited by Computer_checkAndUpdatePersonalAllocationScope',
self.computer.workflow_history['edit_workflow'][-1]['comment']) self.computer.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSCrmMonitoringCheckInstanceInError(testSlapOSMixin): class TestSlapOSCrmMonitoringCheckInstanceInError(SlapOSTestCaseMixin):
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
...@@ -1077,7 +1076,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by H ...@@ -1077,7 +1076,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by H
def test_alarm_check_instance_in_error_archived_hosting_subscription(self): def test_alarm_check_instance_in_error_archived_hosting_subscription(self):
host_sub = self._makeHostingSubscription() host_sub = self._makeHostingSubscription()
host_sub.archive() host_sub.archive()
self._simulateHostingSubscription_checkSoftwareInstanceState() self._simulateHostingSubscription_checkSoftwareInstanceState()
try: try:
...@@ -1089,7 +1088,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by H ...@@ -1089,7 +1088,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by H
self.assertNotEqual('Visited by HostingSubscription_checkSoftwareInstanceState', self.assertNotEqual('Visited by HostingSubscription_checkSoftwareInstanceState',
host_sub.workflow_history['edit_workflow'][-1]['comment']) host_sub.workflow_history['edit_workflow'][-1]['comment'])
class TestSlaposCrmUpdateSupportRequestState(testSlapOSMixin): class TestSlaposCrmUpdateSupportRequestState(SlapOSTestCaseMixin):
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple>
<string>W:1127, 0: Cannot decode using encoding "ascii", unexpected byte at position 32 (invalid-encoded-data)</string> <string>W:1105, 0: Cannot decode using encoding "ascii", unexpected byte at position 32 (invalid-encoded-data)</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
import transaction import transaction
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixinWithAbort
testSlapOSMixin
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
from unittest import skip
import json
from DateTime import DateTime from DateTime import DateTime
from zExceptions import Unauthorized from zExceptions import Unauthorized
class TestSlapOSERP5CleanupActiveProcess(testSlapOSMixin): class TestSlapOSERP5CleanupActiveProcess(SlapOSTestCaseMixinWithAbort):
def beforeTearDown(self):
transaction.abort()
def _simulateActiveProcess_deleteSelf(self): def _simulateActiveProcess_deleteSelf(self):
script_name = 'ActiveProcess_deleteSelf' script_name = 'ActiveProcess_deleteSelf'
...@@ -69,10 +64,7 @@ context.edit(description=description)""") ...@@ -69,10 +64,7 @@ context.edit(description=description)""")
self.check_cleanup_active_process_alarm(DateTime() - 20, self.assertFalse) self.check_cleanup_active_process_alarm(DateTime() - 20, self.assertFalse)
class TestSlapOSERP5ActiveProcess_deleteSelf(testSlapOSMixin): class TestSlapOSERP5ActiveProcess_deleteSelf(SlapOSTestCaseMixinWithAbort):
def beforeTearDown(self):
transaction.abort()
def createActiveProcess(self): def createActiveProcess(self):
new_id = self.generateNewId() new_id = self.generateNewId()
...@@ -100,9 +92,9 @@ class TestSlapOSERP5ActiveProcess_deleteSelf(testSlapOSMixin): ...@@ -100,9 +92,9 @@ class TestSlapOSERP5ActiveProcess_deleteSelf(testSlapOSMixin):
def test_default_use_case(self): def test_default_use_case(self):
active_process = self.createActiveProcess() active_process = self.createActiveProcess()
module = active_process.getParentValue() module = active_process.getParentValue()
id = active_process.getId() ac_id = active_process.getId()
active_process.ActiveProcess_deleteSelf() active_process.ActiveProcess_deleteSelf()
self.assertRaises( self.assertRaises(
KeyError, KeyError,
module._getOb, module._getOb,
id) ac_id)
...@@ -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>testSlapOSERP5Alarm</string> </value> <value> <string>testSlapOSERP5Alarm</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.testSlapOSERP5Alarm</string> </value> <value> <string>test.erp5.testSlapOSERP5Alarm</string> </value>
...@@ -33,11 +45,7 @@ ...@@ -33,11 +45,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W:103, 4: Redefining built-in \'id\' (redefined-builtin)</string>
<string>W: 6, 0: Unused import skip (unused-import)</string>
<string>W: 7, 0: Unused import json (unused-import)</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>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
############################################################################## ##############################################################################
from erp5.component.test.testSlapOSCloudSecurityGroup import TestSlapOSSecurityMixin from erp5.component.test.testSlapOSCloudSecurityGroup import TestSlapOSSecurityMixin
from Products.SlapOS.tests.testSlapOSMixin import changeSkin from erp5.component.test.SlapOSTestCaseMixin import changeSkin
import re import re
import xml_marshaller import xml_marshaller
from AccessControl.SecurityManagement import getSecurityManager, \ from AccessControl.SecurityManagement import getSecurityManager, \
......
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
from Products.SlapOS.tests.testSlapOSMixin import testSlapOSMixin from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixinWithAbort
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
class TestSlapOSGroupRoleSecurityMixin(testSlapOSMixin): class TestSlapOSGroupRoleSecurityMixin(SlapOSTestCaseMixinWithAbort):
abort_transaction = 1
def afterSetUp(self): def afterSetUp(self):
super(TestSlapOSGroupRoleSecurityMixin, self).afterSetUp() SlapOSTestCaseMixinWithAbort.afterSetUp(self)
self.user_id = getSecurityManager().getUser().getId() self.user_id = getSecurityManager().getUser().getId()
def changeOwnership(self, document): def changeOwnership(self, document):
...@@ -16,10 +15,6 @@ class TestSlapOSGroupRoleSecurityMixin(testSlapOSMixin): ...@@ -16,10 +15,6 @@ class TestSlapOSGroupRoleSecurityMixin(testSlapOSMixin):
document.changeOwnership(getSecurityManager().getUser(), False) document.changeOwnership(getSecurityManager().getUser(), False)
document.updateLocalRolesOnSecurityGroups() document.updateLocalRolesOnSecurityGroups()
def generateNewId(self):
return self.getPortalObject().portal_ids.generateNewId(
id_group=('slapos_core_test'))
def _getLocalRoles(self, context): def _getLocalRoles(self, context):
return [x[0] for x in context.get_local_roles()] return [x[0] for x in context.get_local_roles()]
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
# #
############################################################################## ##############################################################################
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
testSlapOSMixin
import os import os
from Testing import ZopeTestCase from Testing import ZopeTestCase
class TestSlapOSDump(testSlapOSMixin): class TestSlapOSDump(SlapOSTestCaseMixin):
def write(self, name, output): def write(self, name, output):
path = os.path.join(os.environ['INSTANCE_HOME'], name) path = os.path.join(os.environ['INSTANCE_HOME'], name)
with open(path, 'w') as f: with open(path, 'w') as f:
......
...@@ -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>testSlapOSERP5SiteDump</string> </value> <value> <string>testSlapOSERP5SiteDump</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.testSlapOSERP5SiteDump</string> </value> <value> <string>test.erp5.testSlapOSERP5SiteDump</string> </value>
...@@ -43,13 +55,28 @@ ...@@ -43,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>
...@@ -62,7 +89,7 @@ ...@@ -62,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>
...@@ -71,7 +98,7 @@ ...@@ -71,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>
......
...@@ -27,12 +27,10 @@ ...@@ -27,12 +27,10 @@
# #
############################################################################## ##############################################################################
import unittest import unittest
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
testSlapOSMixin
import difflib import difflib
class TestSlaposSkinSelection(testSlapOSMixin): class TestSlaposSkinSelection(SlapOSTestCaseMixin):
run_all_test = 1 run_all_test = 1
def getTitle(self): def getTitle(self):
......
...@@ -4,17 +4,16 @@ ...@@ -4,17 +4,16 @@
import unittest import unittest
from Products.ERP5.tests import testXHTML from Products.ERP5.tests import testXHTML
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
testSlapOSMixin
class TestSlapOSXHTML(testSlapOSMixin, testXHTML.TestXHTML): class TestSlapOSXHTML(SlapOSTestCaseMixin, testXHTML.TestXHTML):
# some forms have intentionally empty listbox selections like RSS generators # some forms have intentionally empty listbox selections like RSS generators
JSL_IGNORE_SKIN_LIST = ('erp5_ace_editor', 'erp5_code_mirror', 'erp5_ckeditor', JSL_IGNORE_SKIN_LIST = ('erp5_ace_editor', 'erp5_code_mirror', 'erp5_ckeditor',
'erp5_fckeditor', 'erp5_jquery', 'erp5_jquery_ui', 'erp5_fckeditor', 'erp5_jquery', 'erp5_jquery_ui',
'erp5_svg_editor', 'erp5_xinha_editor', 'erp5_web_renderjs') 'erp5_svg_editor', 'erp5_xinha_editor', 'erp5_web_renderjs')
def afterSetUp(self): def afterSetUp(self):
testSlapOSMixin.afterSetUp(self) SlapOSTestCaseMixin.afterSetUp(self)
# Live tests all uses the same request. For now we remove cell from # Live tests all uses the same request. For now we remove cell from
# previous test that can cause problems in this test. # previous test that can cause problems in this test.
self.portal.REQUEST.other.pop('cell', None) self.portal.REQUEST.other.pop('cell', None)
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2002-2013 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2002-2013 Nexedi SA and Contributors. All Rights Reserved.
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
testSlapOSMixin
import json import json
import httplib import httplib
import urlparse import urlparse
...@@ -25,7 +25,7 @@ def getRelativeUrlFromUrn(urn): ...@@ -25,7 +25,7 @@ def getRelativeUrlFromUrn(urn):
return return
return url return url
class TestSlapOSHypermediaPersonScenario(testSlapOSMixin): class TestSlapOSHypermediaPersonScenario(SlapOSTestCaseMixin):
def _makeUser(self): def _makeUser(self):
person_user = self.makePerson() person_user = self.makePerson()
...@@ -386,10 +386,7 @@ class TestSlapOSHypermediaPersonScenario(testSlapOSMixin): ...@@ -386,10 +386,7 @@ class TestSlapOSHypermediaPersonScenario(testSlapOSMixin):
software_hal = json.loads(response.read()) software_hal = json.loads(response.read())
class TestSlapOSHypermediaInstanceScenario(testSlapOSMixin): class TestSlapOSHypermediaInstanceScenario(SlapOSTestCaseMixin):
def generateNewId(self):
return "%s" % self.portal.portal_ids.generateNewId(
id_group=('slapos_core_test'))
def generateNewSoftwareReleaseUrl(self): def generateNewSoftwareReleaseUrl(self):
return 'http://example.org/test%s.cfg' % self.generateNewId() return 'http://example.org/test%s.cfg' % self.generateNewId()
...@@ -490,7 +487,7 @@ class TestSlapOSHypermediaInstanceScenario(testSlapOSMixin): ...@@ -490,7 +487,7 @@ class TestSlapOSHypermediaInstanceScenario(testSlapOSMixin):
body="", body="",
) )
response = connection.getresponse() response = connection.getresponse()
self.assertEquals(response.status, 200) self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type) self.assertEquals(response.getheader('Content-Type'), content_type)
...@@ -591,7 +588,7 @@ class TestSlapOSHypermediaInstanceScenario(testSlapOSMixin): ...@@ -591,7 +588,7 @@ class TestSlapOSHypermediaInstanceScenario(testSlapOSMixin):
body="", body="",
) )
response = connection.getresponse() response = connection.getresponse()
self.assertEquals(response.status, 200) self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type) self.assertEquals(response.getheader('Content-Type'), content_type)
instance_collection_hal = json.loads(response.read()) instance_collection_hal = json.loads(response.read())
...@@ -613,7 +610,7 @@ class TestSlapOSHypermediaInstanceScenario(testSlapOSMixin): ...@@ -613,7 +610,7 @@ class TestSlapOSHypermediaInstanceScenario(testSlapOSMixin):
body="", body="",
) )
response = connection.getresponse() response = connection.getresponse()
self.assertEquals(response.status, 200) self.assertEquals(response.status, 200)
self.assertEquals(response.getheader('Content-Type'), content_type) self.assertEquals(response.getheader('Content-Type'), content_type)
instance_hal = json.loads(response.read()) instance_hal = json.loads(response.read())
......
...@@ -47,14 +47,14 @@ ...@@ -47,14 +47,14 @@
<value> <value>
<tuple> <tuple>
<string>W: 12, 5: Using type() instead of isinstance() for a typecheck. (unidiomatic-typecheck)</string> <string>W: 12, 5: Using type() instead of isinstance() for a typecheck. (unidiomatic-typecheck)</string>
<string>W: 59, 28: Unused variable \'api_path\' (unused-variable)</string> <string>W: 50, 28: Unused variable \'api_path\' (unused-variable)</string>
<string>W:290, 4: Unused variable \'news_hal\' (unused-variable)</string> <string>W:281, 4: Unused variable \'news_hal\' (unused-variable)</string>
<string>W: 60, 8: Unused variable \'api_fragment\' (unused-variable)</string> <string>W: 51, 8: Unused variable \'api_fragment\' (unused-variable)</string>
<string>W: 59, 38: Unused variable \'api_query\' (unused-variable)</string> <string>W: 50, 38: Unused variable \'api_query\' (unused-variable)</string>
<string>W:395, 4: Unused variable \'software_hal\' (unused-variable)</string> <string>W:386, 4: Unused variable \'software_hal\' (unused-variable)</string>
<string>W:422, 28: Unused variable \'api_path\' (unused-variable)</string> <string>W:412, 28: Unused variable \'api_path\' (unused-variable)</string>
<string>W:422, 38: Unused variable \'api_query\' (unused-variable)</string> <string>W:412, 38: Unused variable \'api_query\' (unused-variable)</string>
<string>W:423, 8: Unused variable \'api_fragment\' (unused-variable)</string> <string>W:413, 8: Unused variable \'api_fragment\' (unused-variable)</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2002-2013 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2002-2013 Nexedi SA and Contributors. All Rights Reserved.
import transaction import transaction
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import \
testSlapOSMixin, changeSkin, simulate SlapOSTestCaseMixinWithAbort, changeSkin, simulate
from zExceptions import Unauthorized from zExceptions import Unauthorized
from unittest import skip from unittest import skip
...@@ -132,14 +132,11 @@ class TestBase_handleAcceptHeader(ERP5HALJSONStyleSkinsMixin): ...@@ -132,14 +132,11 @@ class TestBase_handleAcceptHeader(ERP5HALJSONStyleSkinsMixin):
) )
class TestSlapOSHypermediaMixin(testSlapOSMixin): class TestSlapOSHypermediaMixin(SlapOSTestCaseMixinWithAbort):
def afterSetUp(self): def afterSetUp(self):
testSlapOSMixin.afterSetUp(self) SlapOSTestCaseMixinWithAbort.afterSetUp(self)
self.changeSkin('Hal') self.changeSkin('Hal')
def beforeTearDown(self):
transaction.abort()
def _makePerson(self): def _makePerson(self):
person_user = self.makePerson() person_user = self.makePerson()
self.tic() self.tic()
...@@ -238,7 +235,6 @@ class TestSlapOSPersonERP5Document_getHateoas(TestSlapOSHypermediaMixin): ...@@ -238,7 +235,6 @@ class TestSlapOSPersonERP5Document_getHateoas(TestSlapOSHypermediaMixin):
u'title': u'getHateoasInformation' u'title': u'getHateoasInformation'
}, },
]: ]:
self.assertTrue(action in action_object_slap, \ self.assertTrue(action in action_object_slap, \
"%s not in %s" % (action, action_object_slap)) "%s not in %s" % (action, action_object_slap))
self.assertEquals(results['_links']['action_object_slap_post'], { self.assertEquals(results['_links']['action_object_slap_post'], {
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple>
<string>W: 51, 0: Dangerous default value {} as argument (dangerous-default-value)</string> <string>W: 15, 0: Dangerous default value {} as argument (dangerous-default-value)</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixinWithAbort
testSlapOSMixin
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
from DateTime import DateTime from DateTime import DateTime
class TestSlapOSPayzenUpdateConfirmedPayment(testSlapOSMixin): class TestSlapOSPayzenUpdateConfirmedPayment(SlapOSTestCaseMixinWithAbort):
abort_transaction = 1
def _simulatePaymentTransaction_startPayzenPayment(self): def _simulatePaymentTransaction_startPayzenPayment(self):
script_name = 'PaymentTransaction_startPayzenPayment' script_name = 'PaymentTransaction_startPayzenPayment'
...@@ -215,10 +212,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P ...@@ -215,10 +212,7 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by P
self.assertEquals(transaction.getSimulationState(), 'started') self.assertEquals(transaction.getSimulationState(), 'started')
class TestSlapOSPayzenUpdateStartedPayment(testSlapOSMixin): class TestSlapOSPayzenUpdateStartedPayment(SlapOSTestCaseMixinWithAbort):
def beforeTearDown(self):
self.abort()
def test_not_started_payment(self): def test_not_started_payment(self):
new_id = self.generateNewId() new_id = self.generateNewId()
......
...@@ -5,10 +5,9 @@ ...@@ -5,10 +5,9 @@
# #
############################################################################## ##############################################################################
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
testSlapOSMixin
class TestSlapOSPaymentTransactionOrderBuilder(testSlapOSMixin): class TestSlapOSPaymentTransactionOrderBuilder(SlapOSTestCaseMixin):
def sumReceivable(self, payment_transaction): def sumReceivable(self, payment_transaction):
quantity = .0 quantity = .0
default_source_uid = self.portal.restrictedTraverse( default_source_uid = self.portal.restrictedTraverse(
......
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixinWithAbort
testSlapOSMixin
from DateTime import DateTime from DateTime import DateTime
from zExceptions import Unauthorized from zExceptions import Unauthorized
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
class TestSlapOSCurrency_getIntegrationMapping(testSlapOSMixin): class TestSlapOSCurrency_getIntegrationMapping(SlapOSTestCaseMixinWithAbort):
abort_transaction = 1
def test_integratedCurrency(self): def test_integratedCurrency(self):
currency = self.portal.currency_module.EUR currency = self.portal.currency_module.EUR
...@@ -25,9 +23,7 @@ class TestSlapOSCurrency_getIntegrationMapping(testSlapOSMixin): ...@@ -25,9 +23,7 @@ class TestSlapOSCurrency_getIntegrationMapping(testSlapOSMixin):
currency.Currency_getIntegrationMapping) currency.Currency_getIntegrationMapping)
class TestSlapOSAccountingTransaction_updateStartDate(testSlapOSMixin): class TestSlapOSAccountingTransaction_updateStartDate(SlapOSTestCaseMixinWithAbort):
abort_transaction = 1
def createPaymentTransaction(self): def createPaymentTransaction(self):
new_id = self.generateNewId() new_id = self.generateNewId()
...@@ -52,17 +48,7 @@ class TestSlapOSAccountingTransaction_updateStartDate(testSlapOSMixin): ...@@ -52,17 +48,7 @@ class TestSlapOSAccountingTransaction_updateStartDate(testSlapOSMixin):
date, REQUEST={}) date, REQUEST={})
class TestSlapOSPaymentTransaction_getPayzenId(testSlapOSMixin): class TestSlapOSPaymentTransaction_getPayzenId(SlapOSTestCaseMixinWithAbort):
abort_transaction = 1
def createPaymentTransaction(self):
new_id = self.generateNewId()
return self.portal.accounting_module.newContent(
portal_type='Payment Transaction',
title="Transaction %s" % new_id,
reference="TESTTRANS-%s" % new_id,
)
def test_getPayzenId_newPaymentTransaction(self): def test_getPayzenId_newPaymentTransaction(self):
payment_transaction = self.createPaymentTransaction() payment_transaction = self.createPaymentTransaction()
...@@ -102,17 +88,7 @@ class TestSlapOSPaymentTransaction_getPayzenId(testSlapOSMixin): ...@@ -102,17 +88,7 @@ class TestSlapOSPaymentTransaction_getPayzenId(testSlapOSMixin):
REQUEST={}) REQUEST={})
class TestSlapOSPaymentTransaction_generatePayzenId(testSlapOSMixin): class TestSlapOSPaymentTransaction_generatePayzenId(SlapOSTestCaseMixinWithAbort):
abort_transaction = 1
def createPaymentTransaction(self):
new_id = self.generateNewId()
return self.portal.accounting_module.newContent(
portal_type='Payment Transaction',
title="Transaction %s" % new_id,
reference="TESTTRANS-%s" % new_id,
)
def test_generatePayzenId_newPaymentTransaction(self): def test_generatePayzenId_newPaymentTransaction(self):
payment_transaction = self.createPaymentTransaction() payment_transaction = self.createPaymentTransaction()
...@@ -172,17 +148,7 @@ class TestSlapOSPaymentTransaction_generatePayzenId(testSlapOSMixin): ...@@ -172,17 +148,7 @@ class TestSlapOSPaymentTransaction_generatePayzenId(testSlapOSMixin):
REQUEST={}) REQUEST={})
class TestSlapOSPaymentTransaction_createPayzenEvent(testSlapOSMixin): class TestSlapOSPaymentTransaction_createPayzenEvent(SlapOSTestCaseMixinWithAbort):
abort_transaction = 1
def createPaymentTransaction(self):
new_id = self.generateNewId()
return self.portal.accounting_module.newContent(
portal_type='Payment Transaction',
title="Transaction %s" % new_id,
reference="TESTTRANS-%s" % new_id,
)
def test_createPayzenEvent_REQUEST_disallowed(self): def test_createPayzenEvent_REQUEST_disallowed(self):
payment_transaction = self.createPaymentTransaction() payment_transaction = self.createPaymentTransaction()
...@@ -210,22 +176,7 @@ class TestSlapOSPaymentTransaction_createPayzenEvent(testSlapOSMixin): ...@@ -210,22 +176,7 @@ class TestSlapOSPaymentTransaction_createPayzenEvent(testSlapOSMixin):
self.assertEquals(payzen_event.getTitle(), "foo") self.assertEquals(payzen_event.getTitle(), "foo")
class TestSlapOSPayzenEvent_processUpdate(testSlapOSMixin): class TestSlapOSPayzenEvent_processUpdate(SlapOSTestCaseMixinWithAbort):
abort_transaction = 1
def createPaymentTransaction(self):
new_id = self.generateNewId()
return self.portal.accounting_module.newContent(
portal_type='Payment Transaction',
title="Transaction %s" % new_id,
reference="TESTTRANS-%s" % new_id,
)
def createPayzenEvent(self):
return self.portal.system_event_module.newContent(
portal_type='Payzen Event',
reference='PAY-%s' % self.generateNewId())
def test_processUpdate_REQUEST_disallowed(self): def test_processUpdate_REQUEST_disallowed(self):
event = self.createPayzenEvent() event = self.createPayzenEvent()
...@@ -578,9 +529,7 @@ return addToDate(DateTime(), to_add={'day': -1, 'second': -1}).toZone('UTC'), 'f ...@@ -578,9 +529,7 @@ return addToDate(DateTime(), to_add={'day': -1, 'second': -1}).toZone('UTC'), 'f
'Aborting refused payzen payment.', 'Aborting refused payzen payment.',
payment.workflow_history['accounting_workflow'][-1]['comment']) payment.workflow_history['accounting_workflow'][-1]['comment'])
class TestSlapOSPayzenBase_getPayzenServiceRelativeUrl(testSlapOSMixin): class TestSlapOSPayzenBase_getPayzenServiceRelativeUrl(SlapOSTestCaseMixinWithAbort):
abort_transaction = 1
def test_getPayzenServiceRelativeUrl_REQUEST_disallowed(self): def test_getPayzenServiceRelativeUrl_REQUEST_disallowed(self):
self.assertRaises( self.assertRaises(
...@@ -592,47 +541,28 @@ class TestSlapOSPayzenBase_getPayzenServiceRelativeUrl(testSlapOSMixin): ...@@ -592,47 +541,28 @@ class TestSlapOSPayzenBase_getPayzenServiceRelativeUrl(testSlapOSMixin):
result = self.portal.Base_getPayzenServiceRelativeUrl() result = self.portal.Base_getPayzenServiceRelativeUrl()
self.assertEquals(result, 'portal_secure_payments/slapos_payzen_test') self.assertEquals(result, 'portal_secure_payments/slapos_payzen_test')
class TestSlapOSPayzenSaleInvoiceTransaction_getPayzenPaymentRelatedValue(
SlapOSTestCaseMixinWithAbort):
def test_SaleInvoiceTransaction_getPayzenPaymentRelatedValue(self):
invoice = self.createPayzenSaleInvoiceTransaction()
self.tic()
payment = invoice.SaleInvoiceTransaction_getPayzenPaymentRelatedValue()
self.assertNotEquals(None, payment)
self.assertEquals(payment.getSimulationState(), "started")
self.assertEquals(payment.getCausalityValue(), invoice)
self.assertEquals(payment.getPaymentModeUid(),
self.portal.portal_categories.payment_mode.payzen.getUid())
payment.setStartDate(DateTime())
payment.stop()
payment.immediateReindexObject()
payment = invoice.SaleInvoiceTransaction_getPayzenPaymentRelatedValue()
self.assertEquals(None, payment)
class TestSlapOSPayzenSaleInvoiceTransaction_createReversalPayzenTransaction( class TestSlapOSPayzenSaleInvoiceTransaction_createReversalPayzenTransaction(
testSlapOSMixin): SlapOSTestCaseMixinWithAbort):
abort_transaction = 1
def createPayzenSaleInvoiceTransaction(self):
new_title = self.generateNewId()
new_reference = self.generateNewId()
new_source_reference = self.generateNewId()
new_destination_reference = self.generateNewId()
invoice = self.portal.accounting_module.newContent(
portal_type="Sale Invoice Transaction",
title=new_title,
start_date=DateTime(),
reference=new_reference,
source_reference=new_source_reference,
destination_reference=new_destination_reference,
payment_mode="payzen",
specialise="sale_trade_condition_module/slapos_aggregated_trade_condition",
created_by_builder=1 # to prevent init script to create lines
)
self.portal.portal_workflow._jumpToStateFor(invoice, 'stopped')
invoice.newContent(
title="",
portal_type="Invoice Line",
quantity=-2,
price=2,
)
invoice.newContent(
portal_type="Sale Invoice Transaction Line",
source="account_module/receivable",
quantity=-3,
)
payment = self.portal.accounting_module.newContent(
portal_type="Payment Transaction",
payment_mode="payzen",
causality_value=invoice,
created_by_builder=1 # to prevent init script to create lines
)
self.portal.portal_workflow._jumpToStateFor(payment, 'started')
return invoice
def test_createReversalPayzenTransaction_REQUEST_disallowed(self): def test_createReversalPayzenTransaction_REQUEST_disallowed(self):
self.assertRaises( self.assertRaises(
......
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixinWithAbort
testSlapOSMixin
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
...@@ -15,22 +14,7 @@ vads_url_refused = 'http://example.org/refused' ...@@ -15,22 +14,7 @@ vads_url_refused = 'http://example.org/refused'
vads_url_success = 'http://example.org/success' vads_url_success = 'http://example.org/success'
vads_url_return = 'http://example.org/return' vads_url_return = 'http://example.org/return'
class TestSlapOSPayzenInterfaceWorkflow(testSlapOSMixin): class TestSlapOSPayzenInterfaceWorkflow(SlapOSTestCaseMixinWithAbort):
abort_transaction = 1
def createPaymentTransaction(self):
new_id = self.generateNewId()
return self.portal.accounting_module.newContent(
portal_type='Payment Transaction',
title="Transaction %s" % new_id,
reference="TESTTRANS-%s" % new_id,
)
def createPayzenEvent(self):
return self.portal.system_event_module.newContent(
portal_type='Payzen Event',
reference='PAY-%s' % self.generateNewId())
def _simulatePaymentTransaction_getTotalPayablePrice(self): def _simulatePaymentTransaction_getTotalPayablePrice(self):
script_name = 'PaymentTransaction_getTotalPayablePrice' script_name = 'PaymentTransaction_getTotalPayablePrice'
......
# Copyright (c) 2013 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2013 Nexedi SA and Contributors. All Rights Reserved.
import transaction import transaction
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
testSlapOSMixin
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
class TestSlapOSUpgradeDecisionProcess(testSlapOSMixin): class TestSlapOSUpgradeDecisionProcess(SlapOSTestCaseMixin):
def afterSetUp(self): def afterSetUp(self):
super(TestSlapOSUpgradeDecisionProcess, self).afterSetUp() SlapOSTestCaseMixin.afterSetUp(self)
self.new_id = self.generateNewId() self.new_id = self.generateNewId()
def generateNewId(self):
return "%sTEST" % self.portal.portal_ids.generateNewId(
id_group=('slapos_core_test'))
def _makeUpgradeDecision(self, confirm=True): def _makeUpgradeDecision(self, confirm=True):
upgrade_decision = self.portal.\ upgrade_decision = self.portal.\
upgrade_decision_module.newContent( upgrade_decision_module.newContent(
portal_type="Upgrade Decision", portal_type="Upgrade Decision",
title="TESTUPDE-%s" % self.new_id) title="TESTUPDE-%s" % self.new_id)
if confirm: if confirm:
upgrade_decision.confirm() upgrade_decision.confirm()
return upgrade_decision return upgrade_decision
def _makeComputer(self,new_id): def _makeComputer(self,new_id):
# Clone computer document # Clone computer document
person = self.portal.person_module.template_member\ person = self.portal.person_module.template_member\
...@@ -59,7 +55,7 @@ return %s ...@@ -59,7 +55,7 @@ return %s
upgrade_decision = self._makeUpgradeDecision() upgrade_decision = self._makeUpgradeDecision()
upgrade_decision.start() upgrade_decision.start()
self.tic() self.tic()
self._simulateScript('UpgradeDecision_processUpgrade', 'True') self._simulateScript('UpgradeDecision_processUpgrade', 'True')
try: try:
self.portal.portal_alarms.slapos_pdm_upgrade_decision_process_started.activeSense() self.portal.portal_alarms.slapos_pdm_upgrade_decision_process_started.activeSense()
...@@ -67,7 +63,7 @@ return %s ...@@ -67,7 +63,7 @@ return %s
finally: finally:
self._dropScript('UpgradeDecision_processUpgrade') self._dropScript('UpgradeDecision_processUpgrade')
self.assertEqual( self.assertEqual(
'Visited by UpgradeDecision_processUpgrade', 'Visited by UpgradeDecision_processUpgrade',
upgrade_decision.workflow_history['edit_workflow'][-1]['comment']) upgrade_decision.workflow_history['edit_workflow'][-1]['comment'])
def test_alarm_upgrade_decision_process_planned(self): def test_alarm_upgrade_decision_process_planned(self):
......
...@@ -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>testSlapOSPDMAlarm</string> </value> <value> <string>testSlapOSPDMAlarm</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.testSlapOSPDMAlarm</string> </value> <value> <string>test.erp5.testSlapOSPDMAlarm</string> </value>
...@@ -33,10 +45,7 @@ ...@@ -33,10 +45,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 13, 0: Bad indentation. Found 5 spaces, expected 4 (bad-indentation)</string>
<string>W: 25, 2: Arguments number differs from overridden method (arguments-differ)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -46,13 +55,28 @@ ...@@ -46,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>
...@@ -65,7 +89,7 @@ ...@@ -65,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>
...@@ -74,7 +98,7 @@ ...@@ -74,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>
......
...@@ -26,14 +26,13 @@ ...@@ -26,14 +26,13 @@
# #
############################################################################## ##############################################################################
import transaction from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin, simulate
from Products.SlapOS.tests.testSlapOSMixin import testSlapOSMixin, simulate
from DateTime import DateTime from DateTime import DateTime
class TestSlapOSPDMSkins(testSlapOSMixin): class TestSlapOSPDMSkins(SlapOSTestCaseMixin):
def afterSetUp(self): def afterSetUp(self):
super(TestSlapOSPDMSkins, self).afterSetUp() SlapOSTestCaseMixin.afterSetUp(self)
self.new_id = self.generateNewId() self.new_id = self.generateNewId()
self.request_kw = dict( self.request_kw = dict(
software_title=self.generateNewSoftwareTitle(), software_title=self.generateNewSoftwareTitle(),
...@@ -43,7 +42,7 @@ class TestSlapOSPDMSkins(testSlapOSMixin): ...@@ -43,7 +42,7 @@ class TestSlapOSPDMSkins(testSlapOSMixin):
shared=False, shared=False,
state="started" state="started"
) )
def beforeTearDown(self): def beforeTearDown(self):
id_list = [] id_list = []
for upgrade_decision in self.portal.portal_catalog( for upgrade_decision in self.portal.portal_catalog(
...@@ -52,11 +51,6 @@ class TestSlapOSPDMSkins(testSlapOSMixin): ...@@ -52,11 +51,6 @@ class TestSlapOSPDMSkins(testSlapOSMixin):
self.portal.upgrade_decision_module.manage_delObjects(id_list) self.portal.upgrade_decision_module.manage_delObjects(id_list)
self.tic() self.tic()
def generateNewId(self):
return "%sTEST" % self.portal.portal_ids.generateNewId(
id_group=('slapos_core_test'))
def _makePerson(self): def _makePerson(self):
person_user = self.makePerson(new_id=self.new_id) person_user = self.makePerson(new_id=self.new_id)
return person_user return person_user
...@@ -203,7 +197,7 @@ class TestSlapOSPDMSkins(testSlapOSMixin): ...@@ -203,7 +197,7 @@ class TestSlapOSPDMSkins(testSlapOSMixin):
return hosting_subscription return hosting_subscription
def _makeFullSoftwareInstance(self, hosting_subscription, software_url): def _makeFullSoftwareInstance(self, hosting_subscription, software_url):
software_instance = self.portal.software_instance_module\ software_instance = self.portal.software_instance_module\
.template_software_instance.Base_createCloneDocument(batch_mode=1) .template_software_instance.Base_createCloneDocument(batch_mode=1)
software_instance.edit( software_instance.edit(
...@@ -220,7 +214,7 @@ class TestSlapOSPDMSkins(testSlapOSMixin): ...@@ -220,7 +214,7 @@ class TestSlapOSPDMSkins(testSlapOSMixin):
) )
self.portal.portal_workflow._jumpToStateFor(software_instance, 'start_requested') self.portal.portal_workflow._jumpToStateFor(software_instance, 'start_requested')
software_instance.validate() software_instance.validate()
return software_instance return software_instance
def _makeUpgradeDecision(self): def _makeUpgradeDecision(self):
...@@ -228,19 +222,18 @@ class TestSlapOSPDMSkins(testSlapOSMixin): ...@@ -228,19 +222,18 @@ class TestSlapOSPDMSkins(testSlapOSMixin):
upgrade_decision_module.newContent( upgrade_decision_module.newContent(
portal_type="Upgrade Decision", portal_type="Upgrade Decision",
title="TESTUPDE-%s" % self.new_id) title="TESTUPDE-%s" % self.new_id)
def _makeUpgradeDecisionLine(self, upgrade_decision): def _makeUpgradeDecisionLine(self, upgrade_decision):
return upgrade_decision.newContent( return upgrade_decision.newContent(
portal_type="Upgrade Decision Line", portal_type="Upgrade Decision Line",
title="TESTUPDE-%s" % self.new_id) title="TESTUPDE-%s" % self.new_id)
def test_getSortedSoftwareReleaseListFromSoftwareProduct(self): def test_getSortedSoftwareReleaseListFromSoftwareProduct(self):
software_product = self._makeSoftwareProduct() software_product = self._makeSoftwareProduct()
release_list = software_product.SoftwareProduct_getSortedSoftwareReleaseList( release_list = software_product.SoftwareProduct_getSortedSoftwareReleaseList(
software_product.getReference()) software_product.getReference())
self.assertEqual(release_list, []) self.assertEqual(release_list, [])
# published software release # published software release
software_release1 = self._makeSoftwareRelease() software_release1 = self._makeSoftwareRelease()
software_release1.edit(aggregate_value=software_product.getRelativeUrl(), software_release1.edit(aggregate_value=software_product.getRelativeUrl(),
...@@ -265,8 +258,7 @@ class TestSlapOSPDMSkins(testSlapOSMixin): ...@@ -265,8 +258,7 @@ class TestSlapOSPDMSkins(testSlapOSMixin):
software_product.getReference()) software_product.getReference())
self.assertEquals([release.getUrlString() for release in release_list], self.assertEquals([release.getUrlString() for release in release_list],
['http://example.org/2-%s.cfg' % self.new_id, 'http://example.org/1-%s.cfg' % self.new_id]) ['http://example.org/2-%s.cfg' % self.new_id, 'http://example.org/1-%s.cfg' % self.new_id])
def test_getSortedSoftwareReleaseListFromSoftwareProduct_Changed(self): def test_getSortedSoftwareReleaseListFromSoftwareProduct_Changed(self):
software_product = self._makeSoftwareProduct() software_product = self._makeSoftwareProduct()
release_list = software_product.SoftwareProduct_getSortedSoftwareReleaseList( release_list = software_product.SoftwareProduct_getSortedSoftwareReleaseList(
......
...@@ -45,10 +45,7 @@ ...@@ -45,10 +45,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W:127, 2: Arguments number differs from overridden method (arguments-differ)</string>
<string>W:140, 2: Arguments number differs from overridden method (arguments-differ)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
from Products.SlapOS.tests.testSlapOSMixin import \ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
testSlapOSMixin
from DateTime import DateTime from DateTime import DateTime
from App.Common import rfc1123_date from App.Common import rfc1123_date
...@@ -34,24 +33,22 @@ class Simulator: ...@@ -34,24 +33,22 @@ class Simulator:
'reckwargs': kwargs}) 'reckwargs': kwargs})
open(self.outfile, 'w').write(repr(l)) open(self.outfile, 'w').write(repr(l))
class TestSlapOSSlapToolMixin(testSlapOSMixin): class TestSlapOSSlapToolMixin(SlapOSTestCaseMixin):
def afterSetUp(self, person=None): def afterSetUp(self):
testSlapOSMixin.afterSetUp(self) SlapOSTestCaseMixin.afterSetUp(self)
self.portal_slap = self.portal.portal_slap self.portal_slap = self.portal.portal_slap
new_id = self.generateNewId()
# Prepare computer # Prepare computer
self.computer = self.portal.computer_module.template_computer\ self.computer = self.portal.computer_module.template_computer\
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
self.computer.edit( self.computer.edit(
title="Computer %s" % new_id, title="Computer %s" % self.new_id,
reference="TESTCOMP-%s" % new_id reference="TESTCOMP-%s" % self.new_id
) )
if (person is not None): if getattr(self, "person", None) is not None:
self.computer.edit( self.computer.edit(
source_administration_value=person, source_administration_value=getattr(self, "person", None),
) )
self.computer.validate() self.computer.validate()
self._addERP5Login(self.computer) self._addERP5Login(self.computer)
...@@ -2145,7 +2142,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin): ...@@ -2145,7 +2142,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
self.person = person self.person = person
self.person_reference = person.getReference() self.person_reference = person.getReference()
self.person_user_id = person.getUserId() self.person_user_id = person.getUserId()
TestSlapOSSlapToolMixin.afterSetUp(self, person=person) TestSlapOSSlapToolMixin.afterSetUp(self)
def test_not_accessed_getComputerStatus(self): def test_not_accessed_getComputerStatus(self):
self.login(self.person_user_id) self.login(self.person_user_id)
......
...@@ -46,24 +46,22 @@ ...@@ -46,24 +46,22 @@
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple>
<string>W: 29, 10: Use of eval (eval-used)</string> <string>W: 28, 10: Use of eval (eval-used)</string>
<string>W: 38, 2: Arguments number differs from overridden \'afterSetUp\' method (arguments-differ)</string> <string>W:516, 13: Use of eval (eval-used)</string>
<string>W:519, 13: Use of eval (eval-used)</string> <string>W:567, 13: Use of eval (eval-used)</string>
<string>W:570, 13: Use of eval (eval-used)</string> <string>W:792, 13: Use of eval (eval-used)</string>
<string>W:795, 13: Use of eval (eval-used)</string> <string>W:1400, 13: Use of eval (eval-used)</string>
<string>W:1403, 13: Use of eval (eval-used)</string> <string>W:1513, 13: Use of eval (eval-used)</string>
<string>W:1516, 13: Use of eval (eval-used)</string> <string>W:1567, 13: Use of eval (eval-used)</string>
<string>W:1570, 13: Use of eval (eval-used)</string> <string>W:1607, 13: Use of eval (eval-used)</string>
<string>W:1610, 13: Use of eval (eval-used)</string> <string>W:2229, 13: Use of eval (eval-used)</string>
<string>W:2134, 2: Arguments number differs from overridden \'afterSetUp\' method (arguments-differ)</string> <string>W:2614, 13: Use of eval (eval-used)</string>
<string>W:2231, 13: Use of eval (eval-used)</string> <string>W:2668, 13: Use of eval (eval-used)</string>
<string>W:2616, 13: Use of eval (eval-used)</string> <string>W:2695, 13: Use of eval (eval-used)</string>
<string>W:2670, 13: Use of eval (eval-used)</string> <string>W:2850, 13: Use of eval (eval-used)</string>
<string>W:2697, 13: Use of eval (eval-used)</string> <string>W:2878, 13: Use of eval (eval-used)</string>
<string>W:2852, 13: Use of eval (eval-used)</string> <string>W:2927, 13: Use of eval (eval-used)</string>
<string>W:2880, 13: Use of eval (eval-used)</string> <string>W:2974, 13: Use of eval (eval-used)</string>
<string>W:2929, 13: Use of eval (eval-used)</string>
<string>W:2976, 13: Use of eval (eval-used)</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
# Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2002-2012 Nexedi SA and Contributors. All Rights Reserved.
import transaction from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixinWithAbort
from Products.SlapOS.tests.testSlapOSMixin import \
testSlapOSMixin
class TestSlapOSCoreComputerUpdateFromDict(testSlapOSMixin): class TestSlapOSCoreComputerUpdateFromDict(SlapOSTestCaseMixinWithAbort):
def afterSetUp(self): def afterSetUp(self):
super(TestSlapOSCoreComputerUpdateFromDict, self).afterSetUp() SlapOSTestCaseMixinWithAbort.afterSetUp(self)
self.computer = self.portal.computer_module.template_computer\ self.computer = self.portal.computer_module.template_computer\
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
self.computer.edit( self.computer.edit(
...@@ -23,9 +21,6 @@ class TestSlapOSCoreComputerUpdateFromDict(testSlapOSMixin): ...@@ -23,9 +21,6 @@ class TestSlapOSCoreComputerUpdateFromDict(testSlapOSMixin):
portal_type='Computer Partition') portal_type='Computer Partition')
self.assertEqual(len(partition_list), 0) self.assertEqual(len(partition_list), 0)
def beforeTearDown(self):
transaction.abort()
############################################# #############################################
# Computer network information # Computer network information
############################################# #############################################
...@@ -420,7 +415,7 @@ class TestSlapOSCoreComputerUpdateFromDict(testSlapOSMixin): ...@@ -420,7 +415,7 @@ class TestSlapOSCoreComputerUpdateFromDict(testSlapOSMixin):
id ='foo', id ='foo',
portal_type='Internet Protocol Address', portal_type='Internet Protocol Address',
) )
other_address2 = partition.newContent( partition.newContent(
id ='route_foo', id ='route_foo',
portal_type='Internet Protocol Address', portal_type='Internet Protocol Address',
) )
...@@ -553,11 +548,11 @@ class TestSlapOSCoreComputerUpdateFromDict(testSlapOSMixin): ...@@ -553,11 +548,11 @@ class TestSlapOSCoreComputerUpdateFromDict(testSlapOSMixin):
address_list = partition.contentValues( address_list = partition.contentValues(
portal_type='Internet Protocol Address') portal_type='Internet Protocol Address')
self.assertEqual(len(address_list), 0) self.assertEqual(len(address_list), 0)
other_address = partition.newContent( partition.newContent(
id ='foo', id ='foo',
portal_type='Internet Protocol Address', portal_type='Internet Protocol Address',
) )
default_address = partition.newContent( partition.newContent(
id ='default_network_interface', id ='default_network_interface',
portal_type='Internet Protocol Address', portal_type='Internet Protocol Address',
) )
...@@ -594,11 +589,11 @@ class TestSlapOSCoreComputerUpdateFromDict(testSlapOSMixin): ...@@ -594,11 +589,11 @@ class TestSlapOSCoreComputerUpdateFromDict(testSlapOSMixin):
address_list = partition.contentValues( address_list = partition.contentValues(
portal_type='Internet Protocol Address') portal_type='Internet Protocol Address')
self.assertEqual(len(address_list), 0) self.assertEqual(len(address_list), 0)
other_address = partition.newContent( partition.newContent(
id ='foo', id ='foo',
portal_type='Internet Protocol Address', portal_type='Internet Protocol Address',
) )
default_address = partition.newContent( partition.newContent(
id ='default_network_interface', id ='default_network_interface',
portal_type='Internet Protocol Address', portal_type='Internet Protocol Address',
) )
......
...@@ -45,13 +45,7 @@ ...@@ -45,13 +45,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W:423, 4: Unused variable \'other_address2\' (unused-variable)</string>
<string>W:560, 4: Unused variable \'default_address\' (unused-variable)</string>
<string>W:556, 4: Unused variable \'other_address\' (unused-variable)</string>
<string>W:601, 4: Unused variable \'default_address\' (unused-variable)</string>
<string>W:597, 4: Unused variable \'other_address\' (unused-variable)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
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