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