Move validate_and_update_broadcast_message_status to a utils file

This is because that function is used both when broadcast status
is updated via API and via admin, so it's a shared resource.

Also move and update tests for updating broadcast message status
so things are tested at source and repetition is avoided.
This commit is contained in:
Pea Tyczynska
2022-01-19 16:21:09 +00:00
parent c9afb2f038
commit 52dbdb7518
6 changed files with 420 additions and 409 deletions

View File

@@ -3,13 +3,12 @@ from itertools import chain
from flask import current_app, jsonify, request
from notifications_utils.polygons import Polygons
from notifications_utils.template import BroadcastMessageTemplate
from sqlalchemy.orm.exc import NoResultFound
from app import api_user, authenticated_service
from app.broadcast_message.rest import (
from app.broadcast_message.translators import cap_xml_to_dict
from app.broadcast_message.utils import (
validate_and_update_broadcast_message_status,
)
from app.broadcast_message.translators import cap_xml_to_dict
from app.dao.broadcast_message_dao import (
dao_get_broadcast_message_by_references_and_service_id,
)