fix tests

This commit is contained in:
wh1te909 2024-06-05 05:33:16 +00:00
parent 6e3cad454c
commit 12b5011266
1 changed files with 7 additions and 4 deletions

View File

@ -35,16 +35,19 @@ class AlertTemplateSerializer(ModelSerializer):
fields = "__all__"
def get_action_name(self, obj):
if obj.action_type == AlertTemplateActionType.REST:
if obj.action_type == AlertTemplateActionType.REST and obj.action_rest:
return obj.action_rest.name
return obj.action.name
return obj.action.name if obj.action else ""
def get_resolved_action_name(self, obj):
if obj.resolved_action_type == AlertTemplateActionType.REST:
if (
obj.resolved_action_type == AlertTemplateActionType.REST
and obj.resolved_action_rest
):
return obj.resolved_action_rest.name
return obj.resolved_action.name
return obj.resolved_action.name if obj.resolved_action else ""
def get_applied_count(self, instance):
return (