Commit 451f9b56 authored by Łukasz Nowak's avatar Łukasz Nowak

Cover alarm configuration.

parent 34925c08
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Open Sale Order" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Author</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Author</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Author</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Author</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Author</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>OSO-TEMPLATE</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>template_open_sale_order</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Open Sale Order</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Template Open Sale Order</string> </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/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
#
##############################################################################
from Products.SlapOS.tests.testSlapOSMixin import \
testSlapOSMixin
class TestOpenSaleOrderManagement(testSlapOSMixin):
def test_noOSO_newPerson(self):
person = self.portal.person_module.newContent(portal_type='Person',
reference='TESTP-%s' % self.generateNewId())
person.validate()
self.tic()
self.assertEqual(None, self.portal.portal_catalog.getResultValue(
portal_type='Open Sale Order',
default_destination_section_uid=person.getUid()
))
def test_noOSO_after_fixConsistency(self):
person = self.portal.person_module.newContent(portal_type='Person',
reference='TESTP-%s' % self.generateNewId())
person.validate()
self.tic()
person.fixConsistency()
self.tic()
self.assertEqual(None, self.portal.portal_catalog.getResultValue(
portal_type='Open Sale Order',
default_destination_section_uid=person.getUid()
))
def test_OSO_after_Person_updateOpenSaleOrder(self):
person = self.portal.person_module.newContent(portal_type='Person',
reference='TESTP-%s' % self.generateNewId())
person.validate()
self.tic()
person.Person_updateOpenSaleOrder()
self.tic()
open_sale_order_list = self.portal.portal_catalog(
validation_state='validated',
portal_type='Open Sale Order',
default_destination_section_uid=person.getUid()
)
self.assertEqual(1, len(open_sale_order_list))
open_sale_order = open_sale_order_list[0]
self.assertEqual('SlapOS Subscription Open Sale Order',
open_sale_order.getTitle())
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved.
#
##############################################################################
import transaction
import functools
from Products.ERP5Type.tests.utils import createZODBPythonScript
from Products.SlapOS.tests.testSlapOSMixin import \
testSlapOSMixin
def simulateHostingSubscription_requestUpdateOpenSaleOrder(func):
@functools.wraps(func)
def wrapped(self, *args, **kwargs):
script_name = 'HostingSubscription_requestUpdateOpenSaleOrder'
if script_name in self.portal.portal_skins.custom.objectIds():
raise ValueError('Precondition failed: %s exists in custom' % script_name)
createZODBPythonScript(self.portal.portal_skins.custom,
script_name,
'*args, **kwargs',
'# Script body\n'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by HostingSubscription_requestUpdateOpenSaleOrder') """ )
transaction.commit()
try:
func(self, *args, **kwargs)
finally:
if script_name in self.portal.portal_skins.custom.objectIds():
self.portal.portal_skins.custom.manage_delObjects(script_name)
transaction.commit()
return wrapped
class TestOpenSaleOrderAlarm(testSlapOSMixin):
def test_noOSO_newPerson(self):
person = self.portal.person_module.template_member\
.Base_createCloneDocument(batch_mode=1)
self.tic()
self.assertEqual(None, self.portal.portal_catalog.getResultValue(
portal_type='Open Sale Order',
default_destination_section_uid=person.getUid()
))
def test_noOSO_after_fixConsistency(self):
person = self.portal.person_module.template_member\
.Base_createCloneDocument(batch_mode=1)
self.tic()
person.fixConsistency()
self.tic()
self.assertEqual(None, self.portal.portal_catalog.getResultValue(
portal_type='Open Sale Order',
default_destination_section_uid=person.getUid()
))
def test_OSO_after_Person_updateOpenSaleOrder(self):
person = self.portal.person_module.template_member\
.Base_createCloneDocument(batch_mode=1)
self.tic()
person.Person_updateOpenSaleOrder()
self.tic()
open_sale_order_list = self.portal.portal_catalog(
validation_state='validated',
portal_type='Open Sale Order',
default_destination_section_uid=person.getUid()
)
self.assertEqual(1, len(open_sale_order_list))
open_sale_order = open_sale_order_list[0]
self.assertEqual('SlapOS Subscription Open Sale Order',
open_sale_order.getTitle())
@simulateHostingSubscription_requestUpdateOpenSaleOrder
def test_alarm_HS_validated(self):
subscription = self.portal.hosting_subscription_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
subscription.edit(reference='TESTHS-%s' % self.generateNewId())
self.portal.portal_workflow._jumpToStateFor(subscription, 'validated')
self.tic()
self.portal.portal_alarms\
.slapos_request_update_hosting_subscription_open_sale_order\
.activeSense()
self.tic()
self.assertEqual(
'Visited by HostingSubscription_requestUpdateOpenSaleOrder',
subscription.workflow_history['edit_workflow'][-1]['comment'])
@simulateHostingSubscription_requestUpdateOpenSaleOrder
def test_alarm_HS_validated_OSO_invalidated(self):
subscription = self.portal.hosting_subscription_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
subscription.edit(reference='TESTHS-%s' % self.generateNewId())
self.portal.portal_workflow._jumpToStateFor(subscription, 'validated')
open_sale_order = self.portal.open_sale_order_module\
.template_open_sale_order.Base_createCloneDocument(batch_mode=1)
open_sale_order.edit(reference='TESTOSO-%s' % self.generateNewId())
open_sale_order.newContent(portal_type='Open Sale Order Line',
aggregate=subscription.getRelativeUrl())
self.portal.portal_workflow._jumpToStateFor(open_sale_order, 'invalidated')
self.tic()
self.portal.portal_alarms\
.slapos_request_update_hosting_subscription_open_sale_order\
.activeSense()
self.tic()
self.assertEqual(
'Visited by HostingSubscription_requestUpdateOpenSaleOrder',
subscription.workflow_history['edit_workflow'][-1]['comment'])
@simulateHostingSubscription_requestUpdateOpenSaleOrder
def test_alarm_HS_archived(self):
subscription = self.portal.hosting_subscription_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
subscription.edit(reference='TESTHS-%s' % self.generateNewId())
self.portal.portal_workflow._jumpToStateFor(subscription, 'archived')
self.tic()
self.portal.portal_alarms\
.slapos_request_update_hosting_subscription_open_sale_order\
.activeSense()
self.tic()
self.assertEqual(
'Visited by HostingSubscription_requestUpdateOpenSaleOrder',
subscription.workflow_history['edit_workflow'][-1]['comment'])
@simulateHostingSubscription_requestUpdateOpenSaleOrder
def test_alarm_HS_archived_OSO_validated(self):
subscription = self.portal.hosting_subscription_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
subscription.edit(reference='TESTHS-%s' % self.generateNewId())
self.portal.portal_workflow._jumpToStateFor(subscription, 'archived')
open_sale_order = self.portal.open_sale_order_module\
.template_open_sale_order.Base_createCloneDocument(batch_mode=1)
open_sale_order.edit(reference='TESTOSO-%s' % self.generateNewId())
open_sale_order.newContent(portal_type='Open Sale Order Line',
aggregate=subscription.getRelativeUrl())
self.portal.portal_workflow._jumpToStateFor(open_sale_order, 'validated')
self.tic()
self.portal.portal_alarms\
.slapos_request_update_hosting_subscription_open_sale_order\
.activeSense()
self.tic()
self.assertEqual(
'Visited by HostingSubscription_requestUpdateOpenSaleOrder',
subscription.workflow_history['edit_workflow'][-1]['comment'])
@simulateHostingSubscription_requestUpdateOpenSaleOrder
def test_alarm_HS_validated_OSO_validated(self):
subscription = self.portal.hosting_subscription_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
subscription.edit(reference='TESTHS-%s' % self.generateNewId())
self.portal.portal_workflow._jumpToStateFor(subscription, 'validated')
open_sale_order = self.portal.open_sale_order_module\
.template_open_sale_order.Base_createCloneDocument(batch_mode=1)
open_sale_order.edit(reference='TESTOSO-%s' % self.generateNewId())
open_sale_order.newContent(portal_type='Open Sale Order Line',
aggregate=subscription.getRelativeUrl())
self.portal.portal_workflow._jumpToStateFor(open_sale_order, 'validated')
self.tic()
self.portal.portal_alarms\
.slapos_request_update_hosting_subscription_open_sale_order\
.activeSense()
self.tic()
self.assertNotEqual(
'Visited by HostingSubscription_requestUpdateOpenSaleOrder',
subscription.workflow_history['edit_workflow'][-1]['comment'])
@simulateHostingSubscription_requestUpdateOpenSaleOrder
def test_alarm_HS_archived_OSO_invalidated(self):
subscription = self.portal.hosting_subscription_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
subscription.edit(reference='TESTHS-%s' % self.generateNewId())
self.portal.portal_workflow._jumpToStateFor(subscription, 'archived')
open_sale_order = self.portal.open_sale_order_module\
.template_open_sale_order.Base_createCloneDocument(batch_mode=1)
open_sale_order.edit(reference='TESTOSO-%s' % self.generateNewId())
open_sale_order.newContent(portal_type='Open Sale Order Line',
aggregate=subscription.getRelativeUrl())
self.portal.portal_workflow._jumpToStateFor(open_sale_order, 'invalidated')
self.tic()
self.portal.portal_alarms\
.slapos_request_update_hosting_subscription_open_sale_order\
.activeSense()
self.tic()
self.assertNotEqual(
'Visited by HostingSubscription_requestUpdateOpenSaleOrder',
subscription.workflow_history['edit_workflow'][-1]['comment'])
4
\ No newline at end of file
5
\ No newline at end of file
open_sale_order_module/template_open_sale_order
organisation_module/vifib_client_A
organisation_module/vifib_client_A/**
organisation_module/vifib_internet
......
testSlapOSAccountingOpenSaleOrderManagement
\ No newline at end of file
testSlapOSAccountingSlapOSRequestUpdateHostingSubscriptionOpenSaleOrderAlarm
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment