Commit 95225969 authored by Romain Courteaud's avatar Romain Courteaud :octopus:

Alarm to stop subscription.

parent c5d09554
master alain-message amarisoft cleanup cli_request_parameters_file cliff-cleanup cln-fixes cygwin-link-local dev/buildout_rebase_experiments feat/cli_request_file feat/improve_testcase feat/ipv6_range feat/ipv6_range_and_tun feat/ipv6_range_custom_prefixshift feat/node-secrets feat/openapi feat/rewrite-slapformat feat/slap-connection-include-shared-parts feat/slapgrid_report_stalled feat/slapos-service-list-limit feat/standalone-service feat/testcase_upgrade_test feature/cgroups feature/format-crumbled feature/manager-cpuset fix-invoicing fix/instance-python-executable-inspection fix/ipv6_tap_netmask fix/promise_preexec_fn_deadlock fix/proxy-output fix/request_without_timeout fix/revert_slappopen_threading fix/slapformat_after_ipv6_range_and_tun fix/slapos-ansible fix/slappopen_pipes_and_timeout fix/slappopen_test_timeouts fix/standalone-all fix_promise_logging fix_promise_logging_again fix_slapformat_python3 fix_standalone_format forward_state_propagation hosting_daily_invoice improve_proxy_root_path improve_slapos_cli instance_python_promises instance_state_propagation master-dev message-box nicolas-improve-attention-point promises_with_instance_python proxy-child-instance-name-collisions proxy_relative_urls proxy_root_path_migrate refactor/format slapformat_in_standalone slapgrid_no_supervisord slapos-override-env slapproxy-connection-parameter slapproxy_frontend slapproxy_hatoeas standalone/increase_slapos_error_log_tail_size standalone_node_auto standalone_proxy_path standalone_slapformat_on_no_supervisord standalone_with_hateoas tests tomo_fix_slapos_configurator transparent_json_in_xml 1.6.14 1.6.13 1.6.12 1.6.11 1.6.10 1.6.9 1.6.8 1.6.7 1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.12 1.5.11 1.5.10 1.5.9 1.5.8 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 1.4.28 1.4.27 1.4.26 1.4.25 1.4.24 1.4.23 1.4.22 1.4.21 1.4.20 1.4.19 1.4.17 1.4.16 1.4.15 1.4.14 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 1.4.6 1.4.5 1.4.4 1.4.3 1.4.2 1.4.1 1.4.0 1.3.18 1.3.17 1.3.16 1.3.15 1.3.14 1.3.13 1.3.12 1.3.11 1.3.10 1.3.9 1.3.8 1.3.7 1.3.6.3 1.3.6.2 1.3.6.1 1.3.6 1.3.5 1.3.4 1.3.3 1.3.2 1.3.1 1.3.0 1.2.4.1 1.2.4 1.2.3.1 1.2.3 1.2.2 1.2.1 1.2.0 1.1.3 1.1.2 1.1.1 1.1.0 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 1.0.0 1.0.0rc6 1.0.0rc5 1.0.0rc4 1.0.0rc3 1.0.0-rc1 master-20180917
No related merge requests found
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Alarm" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_stopHostingSubscriptionFromRegularisationRequest</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>slapos_crm_stop_hosting_subscription</string> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_hour_frequency</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute_frequency</string> </key>
<value> <int>30</int> </value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1288051200.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>sense_method_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Stop Hosting Subscription</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
sub_tag = "RegularisationRequest_stopHostingSubscriptionList"\n
portal.portal_catalog.searchAndActivate(\n
portal_type="Regularisation Request", \n
simulation_state=["suspended"],\n
default_resource_uid=[\n
portal.service_module.slapos_crm_stop_acknowledgement.getUid(),\n
portal.service_module.slapos_crm_delete_reminder.getUid(),\n
],\n
method_id=\'RegularisationRequest_stopHostingSubscriptionList\',\n
method_args=(sub_tag,),\n
# Limit activity number, as method_id also calls searchAndActivate\n
activity_count=1,\n
packet_size=1,\n
activate_kw={\'tag\': tag, \'after_tag\': sub_tag}\n
)\n
context.activate(after_tag=tag).getId()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>tag, fixit, params</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_stopHostingSubscriptionFromRegularisationRequest</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
hosting_subscription = context\n
assert hosting_subscription.getDefaultDestinationSection() == person_relative_url\n
person = hosting_subscription.getDefaultDestinationSectionValue()\n
\n
slap_state = hosting_subscription.getSlapState()\n
if (slap_state == \'start_requested\'):\n
person.requestSoftwareInstance(\n
state=\'stopped\',\n
software_release=hosting_subscription.getUrlString(),\n
software_title=hosting_subscription.getTitle(),\n
software_type=hosting_subscription.getSourceReference(),\n
instance_xml=hosting_subscription.getTextContent(),\n
sla_xml=hosting_subscription.getSlaXml(),\n
shared=hosting_subscription.isRootSlave()\n
)\n
return True\n
return False\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>person_relative_url, REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>HostingSubscription_stopFromRegularisationRequest</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
ticket = context\n
state = ticket.getSimulationState()\n
person = ticket.getSourceProjectValue(portal_type="Person")\n
if (state == \'suspended\') and \\\n
(person is not None) and \\\n
(ticket.getResource() in [\'service_module/slapos_crm_stop_acknowledgement\', \'service_module/slapos_crm_delete_reminder\']):\n
\n
portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n
portal_type="Hosting Subscription",\n
validation_state=["validated"],\n
default_destination_section_uid=person.getUid(),\n
method_id=\'HostingSubscription_stopFromRegularisationRequest\',\n
method_args=(person.getRelativeUrl(),),\n
activate_kw={\'tag\': tag}\n
)\n
return True\n
return False\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>tag, REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>RegularisationRequest_stopHostingSubscriptionList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -570,3 +570,105 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by R
self.assertNotEqual(
'Visited by RegularisationRequest_triggerDeleteReminderEscalation',
ticket.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSCrmStopHostingSubscription(testSlapOSMixin):
def beforeTearDown(self):
transaction.abort()
def createRegularisationRequest(self):
new_id = self.generateNewId()
return self.portal.regularisation_request_module.newContent(
portal_type='Regularisation Request',
title="Test Reg. Req.%s" % new_id,
reference="TESTREGREQ-%s" % new_id,
)
def _simulateRegularisationRequest_stopHostingSubscriptionList(self):
script_name = 'RegularisationRequest_stopHostingSubscriptionList'
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 RegularisationRequest_stopHostingSubscriptionList') """ )
transaction.commit()
def _dropRegularisationRequest_stopHostingSubscriptionList(self):
script_name = 'RegularisationRequest_stopHostingSubscriptionList'
if script_name in self.portal.portal_skins.custom.objectIds():
self.portal.portal_skins.custom.manage_delObjects(script_name)
transaction.commit()
def test_alarm_matching_regularisation_request(self):
ticket = self.createRegularisationRequest()
ticket.edit(resource='service_module/slapos_crm_delete_reminder')
ticket.validate()
ticket.suspend()
self.tic()
self._simulateRegularisationRequest_stopHostingSubscriptionList()
try:
self.portal.portal_alarms.\
slapos_crm_stop_hosting_subscription.activeSense()
self.tic()
finally:
self._dropRegularisationRequest_stopHostingSubscriptionList()
self.assertEqual(
'Visited by RegularisationRequest_stopHostingSubscriptionList',
ticket.workflow_history['edit_workflow'][-1]['comment'])
def test_alarm_matching_regularisation_request_2(self):
ticket = self.createRegularisationRequest()
ticket.edit(resource='service_module/slapos_crm_stop_acknowledgement')
ticket.validate()
ticket.suspend()
self.tic()
self._simulateRegularisationRequest_stopHostingSubscriptionList()
try:
self.portal.portal_alarms.\
slapos_crm_stop_hosting_subscription.activeSense()
self.tic()
finally:
self._dropRegularisationRequest_stopHostingSubscriptionList()
self.assertEqual(
'Visited by RegularisationRequest_stopHostingSubscriptionList',
ticket.workflow_history['edit_workflow'][-1]['comment'])
def test_alarm_not_suspended(self):
ticket = self.createRegularisationRequest()
ticket.edit(resource='service_module/slapos_crm_stop_acknowledgement')
ticket.validate()
self.tic()
self._simulateRegularisationRequest_stopHostingSubscriptionList()
try:
self.portal.portal_alarms.\
slapos_crm_stop_hosting_subscription.activeSense()
self.tic()
finally:
self._dropRegularisationRequest_stopHostingSubscriptionList()
self.assertNotEqual(
'Visited by RegularisationRequest_stopHostingSubscriptionList',
ticket.workflow_history['edit_workflow'][-1]['comment'])
def test_alarm_other_resource(self):
ticket = self.createRegularisationRequest()
ticket.edit(resource='service_module/slapos_acknowledgement')
ticket.validate()
ticket.suspend()
self.tic()
self._simulateRegularisationRequest_stopHostingSubscriptionList()
try:
self.portal.portal_alarms.\
slapos_crm_stop_hosting_subscription.activeSense()
self.tic()
finally:
self._dropRegularisationRequest_stopHostingSubscriptionList()
self.assertNotEqual(
'Visited by RegularisationRequest_stopHostingSubscriptionList',
ticket.workflow_history['edit_workflow'][-1]['comment'])
......@@ -1007,3 +1007,293 @@ The slapos team
""" % self.portal.portal_preferences.getPreferredSlaposWebSiteUrl(),
'Deleting acknowledgment.'),
ticket.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSRegularisationRequest_stopHostingSubscriptionList(
testSlapOSMixin):
def beforeTearDown(self):
transaction.abort()
def createRegularisationRequest(self):
new_id = self.generateNewId()
return self.portal.regularisation_request_module.newContent(
portal_type='Regularisation Request',
title="Test Reg. Req.%s" % new_id,
reference="TESTREGREQ-%s" % new_id,
resource='foo/bar',
)
def createPerson(self):
new_id = self.generateNewId()
person = self.portal.person_module.template_member.\
Base_createCloneDocument(batch_mode=1)
person.edit(
title="Person %s" % new_id,
reference="TESTPERS-%s" % new_id,
default_email_text="live_test_%s@example.org" % new_id,
)
person.manage_delObjects(
[x.getId() for x in person.contentValues(portal_type="Assignment")]
)
return person
def createHostingSubscription(self):
new_id = self.generateNewId()
hosting_subscription = self.portal.hosting_subscription_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
hosting_subscription.edit(
reference="TESTHS-%s" % new_id,
)
hosting_subscription.validate()
self.portal.portal_workflow._jumpToStateFor(
hosting_subscription, 'start_requested')
return hosting_subscription
def test_stopHostingSubscriptionList_REQUEST_disallowed(self):
ticket = self.createRegularisationRequest()
self.assertRaises(
Unauthorized,
ticket.RegularisationRequest_stopHostingSubscriptionList,
'footag',
REQUEST={})
@simulate('HostingSubscription_stopFromRegularisationRequest',
'person, REQUEST=None',
'context.portal_workflow.doActionFor(' \
'context, action="edit_action", ' \
'comment="Visited by HostingSubscription_stopFromRegularisationRequest ' \
'%s" % (person))')
def test_stopHostingSubscriptionList_matching_subscription(self):
person = self.createPerson()
ticket = self.createRegularisationRequest()
hosting_subscription = self.createHostingSubscription()
ticket.edit(
source_project_value=person,
resource='service_module/slapos_crm_stop_acknowledgement',
)
ticket.validate()
ticket.suspend()
hosting_subscription.edit(
destination_section=person.getRelativeUrl(),
)
self.tic()
result = ticket.\
RegularisationRequest_stopHostingSubscriptionList('footag')
self.assertTrue(result)
self.tic()
self.assertEqual(
'Visited by HostingSubscription_stopFromRegularisationRequest ' \
'%s' % person.getRelativeUrl(),
hosting_subscription.workflow_history['edit_workflow'][-1]['comment'])
@simulate('HostingSubscription_stopFromRegularisationRequest',
'person, REQUEST=None',
'context.portal_workflow.doActionFor(' \
'context, action="edit_action", ' \
'comment="Visited by HostingSubscription_stopFromRegularisationRequest ' \
'%s" % (person))')
def test_stopHostingSubscriptionList_matching_subscription_2(self):
person = self.createPerson()
ticket = self.createRegularisationRequest()
hosting_subscription = self.createHostingSubscription()
ticket.edit(
source_project_value=person,
resource='service_module/slapos_crm_delete_reminder',
)
ticket.validate()
ticket.suspend()
hosting_subscription.edit(
destination_section=person.getRelativeUrl(),
)
self.tic()
result = ticket.\
RegularisationRequest_stopHostingSubscriptionList('footag')
self.assertTrue(result)
self.tic()
self.assertEqual(
'Visited by HostingSubscription_stopFromRegularisationRequest ' \
'%s' % person.getRelativeUrl(),
hosting_subscription.workflow_history['edit_workflow'][-1]['comment'])
@simulate('HostingSubscription_stopFromRegularisationRequest',
'*args, **kwargs',
'raise NotImplementedError, "Should not have been called"')
def test_stopHostingSubscriptionList_other_subscription(self):
person = self.createPerson()
ticket = self.createRegularisationRequest()
hosting_subscription = self.createHostingSubscription()
ticket.edit(
source_project_value=person,
resource='service_module/slapos_crm_stop_acknowledgement',
)
ticket.validate()
ticket.suspend()
self.tic()
result = ticket.\
RegularisationRequest_stopHostingSubscriptionList('footag')
self.assertTrue(result)
self.tic()
@simulate('HostingSubscription_stopFromRegularisationRequest',
'*args, **kwargs',
'raise NotImplementedError, "Should not have been called"')
def test_stopHostingSubscriptionList_no_person(self):
person = self.createPerson()
ticket = self.createRegularisationRequest()
ticket.edit(
resource='service_module/slapos_crm_stop_acknowledgement',
)
ticket.validate()
ticket.suspend()
self.tic()
result = ticket.\
RegularisationRequest_stopHostingSubscriptionList('footag')
self.assertFalse(result)
self.tic()
@simulate('HostingSubscription_stopFromRegularisationRequest',
'*args, **kwargs',
'raise NotImplementedError, "Should not have been called"')
def test_stopHostingSubscriptionList_not_suspended(self):
person = self.createPerson()
ticket = self.createRegularisationRequest()
hosting_subscription = self.createHostingSubscription()
ticket.edit(
source_project_value=person,
resource='service_module/slapos_crm_stop_acknowledgement',
)
ticket.validate()
self.tic()
result = ticket.\
RegularisationRequest_stopHostingSubscriptionList('footag')
self.assertFalse(result)
self.tic()
@simulate('HostingSubscription_stopFromRegularisationRequest',
'*args, **kwargs',
'raise NotImplementedError, "Should not have been called"')
def test_stopHostingSubscriptionList_other_resource(self):
person = self.createPerson()
ticket = self.createRegularisationRequest()
hosting_subscription = self.createHostingSubscription()
ticket.edit(
source_project_value=person,
resource='service_module/slapos_crm_acknowledgement',
)
ticket.validate()
ticket.suspend()
self.tic()
result = ticket.\
RegularisationRequest_stopHostingSubscriptionList('footag')
self.assertFalse(result)
self.tic()
class TestSlapOSHostingSubscription_stopFromRegularisationRequest(
testSlapOSMixin):
def beforeTearDown(self):
transaction.abort()
def createPerson(self):
new_id = self.generateNewId()
person = self.portal.person_module.template_member.\
Base_createCloneDocument(batch_mode=1)
person.edit(
title="Person %s" % new_id,
reference="TESTPERS-%s" % new_id,
default_email_text="live_test_%s@example.org" % new_id,
)
person.manage_delObjects(
[x.getId() for x in person.contentValues(portal_type="Assignment")]
)
return person
def createHostingSubscription(self):
new_id = self.generateNewId()
hosting_subscription = self.portal.hosting_subscription_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
hosting_subscription.edit(
reference="TESTHS-%s" % new_id,
)
hosting_subscription.validate()
self.portal.portal_workflow._jumpToStateFor(
hosting_subscription, 'start_requested')
return hosting_subscription
def test_stopFromRegularisationRequest_REQUEST_disallowed(self):
self.assertRaises(
Unauthorized,
self.portal.HostingSubscription_stopFromRegularisationRequest,
'',
REQUEST={})
def test_stopFromRegularisationRequest_matching_subscription(self):
person = self.createPerson()
hosting_subscription = self.createHostingSubscription()
hosting_subscription.edit(
destination_section=person.getRelativeUrl(),
)
self.tic()
software_release = hosting_subscription.getUrlString()
software_title = hosting_subscription.getTitle()
software_type = hosting_subscription.getSourceReference()
instance_xml = hosting_subscription.getTextContent()
sla_xml = hosting_subscription.getSlaXml()
shared = hosting_subscription.isRootSlave()
self.assertEquals(hosting_subscription.getSlapState(), "start_requested")
result = hosting_subscription.\
HostingSubscription_stopFromRegularisationRequest(person.getRelativeUrl())
self.assertEquals(result, True)
self.assertEquals(hosting_subscription.getUrlString(), software_release)
self.assertEquals(hosting_subscription.getTitle(), software_title)
self.assertEquals(hosting_subscription.getSourceReference(), software_type)
self.assertEquals(hosting_subscription.getTextContent(), instance_xml)
self.assertEquals(hosting_subscription.getSlaXml(), sla_xml)
self.assertEquals(hosting_subscription.isRootSlave(), shared)
self.assertEquals(hosting_subscription.getSlapState(), "stop_requested")
def test_stopFromRegularisationRequest_stopped_subscription(self):
person = self.createPerson()
hosting_subscription = self.createHostingSubscription()
hosting_subscription.edit(
destination_section=person.getRelativeUrl(),
)
self.portal.portal_workflow._jumpToStateFor(
hosting_subscription, 'stop_requested')
result = hosting_subscription.\
HostingSubscription_stopFromRegularisationRequest(person.getRelativeUrl())
self.assertEquals(result, False)
def test_stopFromRegularisationRequest_non_matching_person(self):
hosting_subscription = self.createHostingSubscription()
self.assertRaises(
AssertionError,
hosting_subscription.HostingSubscription_stopFromRegularisationRequest,
'foobar')
15
\ No newline at end of file
16
\ No newline at end of file
......@@ -2,6 +2,7 @@ event_module/slapos_crm_web_message_template
portal_alarms/slapos_crm_cancel_invoice
portal_alarms/slapos_crm_create_regularisation_request
portal_alarms/slapos_crm_invalidate_suspended_regularisation_request
portal_alarms/slapos_crm_stop_hosting_subscription
portal_alarms/slapos_crm_trigger_acknowledgment_escalation
portal_alarms/slapos_crm_trigger_delete_reminder_escalation
portal_alarms/slapos_crm_trigger_stop_acknowledgment_escalation
......
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