mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-14 09:12:06 -05:00
Updated test_validators to test the contents of the error messages.
Added some tests to the test_post_notifications. Added a errorhandler for AuthErrors. This endpoint is not being used anywhere, however there is some common code being used in the v1 post endpoint. The only thing that may be affected is the error response, hopefully they are the same.
This commit is contained in:
@@ -16,14 +16,15 @@ def check_service_message_limit(key_type, service):
|
||||
|
||||
def check_template_is_for_notification_type(notification_type, template_type):
|
||||
if notification_type != template_type:
|
||||
raise BadRequestError(
|
||||
message="{0} template is not suitable for {1} notification".format(template_type,
|
||||
notification_type))
|
||||
message = "{0} template is not suitable for {1} notification".format(template_type,
|
||||
notification_type)
|
||||
raise BadRequestError(fields=[{'template': message}], message=message)
|
||||
|
||||
|
||||
def check_template_is_active(template):
|
||||
if template.archived:
|
||||
raise BadRequestError(message="Template has been deleted")
|
||||
raise BadRequestError(fields=[{'template': 'Template has been deleted'}],
|
||||
message="Template has been deleted")
|
||||
|
||||
|
||||
def service_can_send_to_recipient(send_to, key_type, service):
|
||||
|
||||
Reference in New Issue
Block a user