Commit 640d8bd5 authored by Romain Courteaud's avatar Romain Courteaud

slapos_subscription_request: test slapos_subscription_request_create_from_orphaned_item

parent f743d85b
...@@ -5,14 +5,14 @@ portal = context.getPortalObject() ...@@ -5,14 +5,14 @@ portal = context.getPortalObject()
# TODO find a way to check the portal type # TODO find a way to check the portal type
select_dict= {'aggregate__related__uid': None} select_dict= {'aggregate__related__uid': None}
kw = {} kw = {}
kw['select_dict']=select_dict kw['select_dict'] = select_dict
kw['left_join_list']=select_dict.keys() kw['left_join_list'] = select_dict.keys()
kw['aggregate__related__uid']=None kw.update(select_dict)
portal.portal_catalog.searchAndActivate( portal.portal_catalog.searchAndActivate(
method_id='Item_createSubscriptionRequest', method_id='Item_createSubscriptionRequest',
# Project are created only from UI for now # Project are created only from UI for now
portal_type=["Instance Tree", "Project"], portal_type=["Instance Tree"],
activate_kw={'tag': tag}, activate_kw={'tag': tag},
**kw **kw
) )
......
...@@ -23,4 +23,43 @@ from erp5.component.test.SlapOSTestCaseMixin import \ ...@@ -23,4 +23,43 @@ from erp5.component.test.SlapOSTestCaseMixin import \
class TestSlapOSSubscriptionRequestProcessAlarm(SlapOSTestCaseMixin): class TestSlapOSSubscriptionRequestProcessAlarm(SlapOSTestCaseMixin):
pass def test_alarm_slapos_subscription_request_create_from_orphaned_item(self):
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
)
self._test_alarm(alarm, instance_tree, 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
)
self.portal.subscription_request_module.newContent(
portal_type='Subscription Request',
title="Test Subscription Request %s" % self.new_id,
aggregate_value=instance_tree
)
self._test_alarm_not_visited(alarm, instance_tree, script_name)
#####################################################
# Instance Tree aggregated to another portal type
# TODO how to ensure Instance Tree is visited?
instance_tree = self.portal.instance_tree_module.newContent(
portal_type='Instance Tree',
title="Test Instance Tree another portal type %s" % 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
)
self._test_alarm_not_visited(alarm, instance_tree, script_name)
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