Exemple #1
0
 def test(self):
     assert list(get_actions_for_trigger(self.trigger)) == []
     action = create_alert_rule_trigger_action(
         self.trigger,
         AlertRuleTriggerAction.Type.EMAIL,
         AlertRuleTriggerAction.TargetType.USER,
         target_identifier=six.text_type(self.user.id),
     )
     assert list(get_actions_for_trigger(self.trigger)) == [action]
    def get(self, request, organization, alert_rule, alert_rule_trigger):
        """
        Fetches actions for a trigger
        """
        if not features.has(
                "organizations:incidents", organization, actor=request.user):
            raise ResourceDoesNotExist

        return self.paginate(
            request,
            queryset=get_actions_for_trigger(alert_rule_trigger),
            order_by="type",
            paginator_cls=OffsetPaginator,
            on_results=lambda x: serialize(x, request.user),
            default_per_page=25,
        )