From 5388ff98947216a96bac4f327ed371fecdda7ea6 Mon Sep 17 00:00:00 2001 From: Robi9 Date: Fri, 20 Jun 2025 17:22:33 -0300 Subject: [PATCH] Add 'category' field to WhatsappBroadcastWriteSerializer and update related tests --- temba/api/v2/serializers.py | 1 + temba/api/v2/tests.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/temba/api/v2/serializers.py b/temba/api/v2/serializers.py index 7b8f54e643..8d87160a3e 100644 --- a/temba/api/v2/serializers.py +++ b/temba/api/v2/serializers.py @@ -334,6 +334,7 @@ def _validate_and_assign_template(self, data, template_data, channel_data): "uuid": str(template.uuid), "variables": template_data.get("variables", []), "locale": template_data.get("locale", None), + "category": template_data.get("category", None), } except Template.DoesNotExist: diff --git a/temba/api/v2/tests.py b/temba/api/v2/tests.py index 0f537d42bb..9229215c15 100644 --- a/temba/api/v2/tests.py +++ b/temba/api/v2/tests.py @@ -971,7 +971,9 @@ def test_whatsapp_broadcasts(self, mock_queue_broadcast): # try to send msg with an existing template expected_metadata = { - "template": {"name": template.name, "uuid": template.uuid, "variables": [], "locale": None}, + "template": { + "name": template.name, "uuid": template.uuid, "variables": [], "locale": None, "category": None + }, "text": "Send a message", } @@ -1197,7 +1199,9 @@ def test_whatsapp_broadcasts(self, mock_queue_broadcast): ) expected_metadata = { - "template": {"name": template.name, "uuid": template.uuid, "variables": ["1"], "locale": None} + "template": { + "name": template.name, "uuid": template.uuid, "variables": ["1"], "locale": None, "category": None + } } broadcast = Broadcast.objects.get(id=response.json()["id"])