Commit 65c779b5 authored by Romain Courteaud's avatar Romain Courteaud

slapos_subscription_request: test that Subscription Request is created from Compute Node

parent 7e3ae743
......@@ -23,42 +23,48 @@ from erp5.component.test.SlapOSTestCaseMixin import \
class TestSlapOSSubscriptionRequestProcessAlarm(SlapOSTestCaseMixin):
def test_alarm_slapos_subscription_request_create_from_orphaned_item(self):
def _test_alarm_slapos_subscription_request_create_from_orphaned_item(self, portal_type):
script_name = "Item_createSubscriptionRequest"
alarm = self.portal.portal_alarms.slapos_subscription_request_create_from_orphaned_item
#####################################################
# Instance Tree without Subscription Request
instance_tree = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree',
title="Test Instance Tree no subscription %s" % self.new_id
document = self.portal.getDefaultModule(portal_type).newContent(
portal_type=portal_type,
title="Test %s no subscription %s" % (portal_type, self.new_id)
)
self._test_alarm(alarm, instance_tree, script_name)
self._test_alarm(alarm, document, script_name)
#####################################################
# Instance Tree with Subscription Request
instance_tree = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree',
title="Test Instance Tree no subscription %s" % self.new_id
document = self.portal.getDefaultModule(portal_type).newContent(
portal_type=portal_type,
title="Test %s no subscription %s" % (portal_type, self.new_id)
)
self.portal.subscription_request_module.newContent(
portal_type='Subscription Request',
title="Test Subscription Request %s" % self.new_id,
aggregate_value=instance_tree
aggregate_value=document
)
self._test_alarm_not_visited(alarm, instance_tree, script_name)
self._test_alarm_not_visited(alarm, document, script_name)
#####################################################
# Instance Tree aggregated to another portal type
instance_tree = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree',
title="Test Instance Tree another portal type %s" % self.new_id
document = self.portal.getDefaultModule(portal_type).newContent(
portal_type=portal_type,
title="Test %s another portal type %s" % (portal_type, self.new_id)
)
self.portal.sale_packing_list_module.newContent(
portal_type='Sale Packing List',
title="Test Sale Packing List %s" % self.new_id,
).newContent(
portal_type="Sale Packing List Line",
aggregate_value=instance_tree
aggregate_value=document
)
self._test_alarm(alarm, instance_tree, script_name)
self._test_alarm(alarm, document, script_name)
def test_alarm_slapos_subscription_request_create_from_orphaned_instance_tree(self):
self._test_alarm_slapos_subscription_request_create_from_orphaned_item("Instance Tree")
def test_alarm_slapos_subscription_request_create_from_orphaned_compute_node(self):
self._test_alarm_slapos_subscription_request_create_from_orphaned_item("Compute Node")
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