Small refactor to how notification_schemas are tested.

My local build was not always getting the optional requirement for the jsonschema uri format checker (rfc3987).
The requirement has been added to the requirements_for_test file.
I changed the tests to validate the response schema from the post_notifications tests, this way we can tell if we are breaking the contract.
This showed that the email_from was not returning the entire email address but just the username, that has been corrected here.
Removed the response schema validation tests since they are not being testing in the post notification tests.
This commit is contained in:
Rebecca Law
2017-09-11 11:10:45 +01:00
parent 3309325cd3
commit 0a21f1f3e8
6 changed files with 16 additions and 146 deletions

View File

@@ -12,7 +12,9 @@ from app.models import KEY_TYPE_TEST
from app.models import LETTER_TYPE
from app.models import Notification
from app.models import SMS_TYPE
from app.schema_validation import validate
from app.v2.errors import RateLimitError
from app.v2.notifications.notification_schemas import post_letter_response
from app.variables import LETTER_TEST_API_FILENAME
from app.variables import LETTER_API_FILENAME
@@ -53,6 +55,7 @@ def test_post_letter_notification_returns_201(client, sample_letter_template, mo
resp_json = letter_request(client, data, service_id=sample_letter_template.service_id)
assert validate(resp_json, post_letter_response) == resp_json
job = Job.query.one()
assert job.original_file_name == LETTER_API_FILENAME
notification = Notification.query.one()