add POST response tests

assert that the response for emails and sms is formatted as expected

also moved schemas into subdirectory to make folder more legible
This commit is contained in:
Leo Hemsted
2016-08-31 12:22:05 +01:00
parent fabbb8b01b
commit c91358673f
11 changed files with 105 additions and 7 deletions

View File

@@ -4,8 +4,9 @@ from flask import json
import jsonschema
def validate(json_string, schema_filename):
resolver = jsonschema.RefResolver('file://' + os.path.dirname(__file__) + '/', None)
with open(os.path.join(os.path.dirname(__file__), schema_filename)) as schema:
schema_dir = os.path.join(os.path.dirname(__file__), 'schemas')
resolver = jsonschema.RefResolver('file://' + schema_dir + '/', None)
with open(os.path.join(schema_dir, schema_filename)) as schema:
jsonschema.validate(
json.loads(json_string),
json.load(schema),