remove cancel notif option: only for letters

This commit is contained in:
stvnrlly
2023-03-02 14:19:03 -05:00
parent f6e91db5bf
commit 68512a272f
2 changed files with 0 additions and 49 deletions

View File

@@ -458,26 +458,6 @@ def get_notification_for_service(service_id, notification_id):
), 200
# TODO: possibly unnecessary after removing letters
@service_blueprint.route('/<uuid:service_id>/notifications/<uuid:notification_id>/cancel', methods=['POST'])
def cancel_notification_for_service(service_id, notification_id):
notification = notifications_dao.get_notification_by_id(notification_id, service_id)
if not notification:
raise InvalidRequest('Notification not found', status_code=404)
else:
raise InvalidRequest('Notification cannot be cancelled - only letters can be cancelled', status_code=400)
updated_notification = notifications_dao.update_notification_status_by_id(
notification_id,
NOTIFICATION_CANCELLED,
)
return jsonify(
notification_with_template_schema.dump(updated_notification)
), 200
def search_for_notification_by_to_field(service_id, search_term, statuses, notification_type):
results = notifications_dao.dao_get_notifications_by_recipient_or_reference(
service_id=service_id,

View File

@@ -3006,35 +3006,6 @@ def test_get_organisation_for_service_id_return_empty_dict_if_service_not_in_org
assert response == {}
def test_cancel_notification_for_service_raises_invalid_request_when_notification_is_not_found(
admin_request,
sample_service,
fake_uuid,
):
response = admin_request.post(
'service.cancel_notification_for_service',
service_id=sample_service.id,
notification_id=fake_uuid,
_expected_status=404
)
assert response['message'] == 'Notification not found'
assert response['result'] == 'error'
def test_cancel_notification_for_service_raises_invalid_request_when_notification_is_not_a_letter(
admin_request,
sample_notification,
):
response = admin_request.post(
'service.cancel_notification_for_service',
service_id=sample_notification.service_id,
notification_id=sample_notification.id,
_expected_status=400
)
assert response['message'] == 'Notification cannot be cancelled - only letters can be cancelled'
assert response['result'] == 'error'
def test_get_monthly_notification_data_by_service(sample_service, admin_request):
create_ft_notification_status(date(2019, 4, 17), notification_type='sms', service=sample_service,
notification_status='delivered')