Added schemas + tests & updated get template tests

This commit is contained in:
Ken Tsang
2017-03-17 13:30:06 +00:00
parent 5fcc80c7be
commit fad67e1bdd
2 changed files with 107 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
from app.models import TEMPLATE_TYPES
from app.schema_validation.definitions import uuid
from app.schema_validation.definitions import uuid, personalisation
get_template_by_id_request = {
@@ -39,3 +39,30 @@ get_template_by_id_response = {
},
"required": ["id", "type", "created_at", "updated_at", "version", "created_by", "body"]
}
post_template_preview_request = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "POST template schema",
"type": "object",
"title": "POST v2/template/{id}/preview",
"properties": {
"id": uuid,
"personalisation": personalisation
},
"required": ["id", "personalisation"]
}
post_template_preview_response = {
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "POST template preview schema response",
"type": "object",
"title": "reponse v2/template/{id}/preview",
"properties": {
"id": uuid,
"type": {"enum": TEMPLATE_TYPES},
"version": {"type": "integer"},
"body": {"type": "string"},
"subject": {"type": ["string", "null"]}
},
"required": ["id", "type", "version", "body"]
}