Created
February 27, 2015 15:16
Revisions
-
mcreenan created this gist
Feb 27, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ from eve import Eve app = Eve() app.run() This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,59 @@ DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ' RESOURCE_METHODS = ['GET', 'POST', 'DELETE'] ITEM_METHODS = ['GET', 'PATCH', 'DELETE'] # Failure #1: # With the following payload: # {"location": { # "_id": "test" }, # "extract_time": "2015-02-28T00:00:00Z", # "date": "2015-02-28T00:00:00Z", # "total": "r123" } # The follow response is received # {"_status": "ERR", # "_issues": { "total": "must be of integer type", # "extract_time": "must be of datetime type" }, # "_error": { "message": "Insertion failure: 1 document(s) contain(s) error(s)", # "code": 422 } } # The "total" error is expected, the "extract_time" one is not # If "total" is changed to 123, then the document is created successfully, # despite there being no change to extract_time # Failure #2: # With the following payload: # {"location": { # "_id": "test" }, # "extract_time": "2015-02-28T00:00:00Z", # "date": "2015-02-28T00:00:00Z", # "total": "123" } # A 200 OK is received, which is not expected # The "total" field is actually a string, when an integer is expected DOMAIN = { 'attendance': { 'schema': { 'extract_time': { 'required': True, 'type': 'datetime' }, 'location': { 'required': True, 'type': 'dict', 'schema': { '_id': { 'required': True, 'type': 'string', }, } }, 'date': { 'required': True, 'type': 'datetime', }, 'total': { 'required': True, 'type': 'integer', }, }, }, }