Add test for when no content or template provided

This is the missing invalid permutation of fields for creating a
broadcast.
This commit is contained in:
Chris Hill-Scott
2021-01-19 15:28:08 +00:00
parent e161f6e4a1
commit 94aea8a820

View File

@@ -280,6 +280,26 @@ def test_create_broadcast_message_400s_if_reference_not_provided_with_content(
)
def test_create_broadcast_message_400s_if_no_content_or_template(
admin_request,
sample_broadcast_service,
):
response = admin_request.post(
'broadcast_message.create_broadcast_message',
_data={
'service_id': str(sample_broadcast_service.id),
'created_by': str(sample_broadcast_service.created_by_id),
},
service_id=sample_broadcast_service.id,
_expected_status=400
)
assert len(response['errors']) == 1
assert response['errors'][0]['error'] == 'ValidationError'
assert response['errors'][0]['message'].endswith(
'is not valid under any of the given schemas'
)
@pytest.mark.parametrize('status', [
BroadcastStatusType.DRAFT,
BroadcastStatusType.PENDING_APPROVAL,