mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-04 18:31:13 -05:00
Remove custom error message from personalisation validation
There's no longer a single err msg that fits all problems with personalisation - since letters expect specific fields there
This commit is contained in:
@@ -127,7 +127,7 @@ def test_post_sms_schema_with_personalisation_that_is_not_a_dict():
|
||||
error = json.loads(str(e.value))
|
||||
assert len(error.get('errors')) == 1
|
||||
assert error['errors'] == [{'error': 'ValidationError',
|
||||
'message': "personalisation should contain key value pairs"}]
|
||||
'message': "personalisation not_a_dict is not of type object"}]
|
||||
assert error.get('status_code') == 400
|
||||
assert len(error.keys()) == 2
|
||||
|
||||
|
||||
@@ -100,6 +100,26 @@ def test_notification_returns_400_for_schema_problems(
|
||||
}]
|
||||
|
||||
|
||||
def test_notification_returns_400_if_address_doesnt_have_underscores(
|
||||
client,
|
||||
sample_letter_template
|
||||
):
|
||||
data = {
|
||||
'template_id': str(sample_letter_template.id),
|
||||
'personalisation': {
|
||||
'address line 1': 'Her Royal Highness Queen Elizabeth II',
|
||||
'postcode': 'SW1 1AA',
|
||||
}
|
||||
}
|
||||
|
||||
error_json = letter_request(client, data, service_id=sample_letter_template.service_id, _expected_status=400)
|
||||
|
||||
assert error_json['status_code'] == 400
|
||||
assert error_json['errors'] == [{
|
||||
'error': 'ValidationError',
|
||||
'message': 'personalisation address_line_1 is a required property'
|
||||
}]
|
||||
|
||||
|
||||
def test_returns_a_429_limit_exceeded_if_rate_limit_exceeded(
|
||||
client,
|
||||
|
||||
Reference in New Issue
Block a user