Comprehensive test suite for json_server

Registered by Henrik Ingo

List of tests we should do in JSON Server

Blueprint information

Status:
Complete
Approver:
Henrik Ingo
Priority:
Undefined
Drafter:
Henrik Ingo
Direction:
Approved
Assignee:
Mohit Srivastava
Definition:
New
Series goal:
None
Implementation:
Implemented
Milestone target:
milestone icon 7.2.3
Started by
Henrik Ingo
Completed by
Henrik Ingo

Related branches

Sprints

Whiteboard

Currently you have:
****************************************
exec curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"_id":1,"document":{"firstname":"Henrik","lastname":"Ingo","age": 35}}' 'http://localhost:$JSON_SERVER_PORT/json?schema=json&table=people'

--exec curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"_id":1,"document":{"firstname":"Henrik","lastname":"Ingo","age": 35}}' 'http://localhost:$JSON_SERVER_PORT/json'

--exec curl 'http://localhost:$JSON_SERVER_PORT/json?schema=json&table=people&_id=1'
*****************************************************

I propose changes: Between the first and second POST, do a GET to retrieve the inserted document. Now change the second POST so the document is different (like "age" : 36)

Ideas for more tests:

Leave out _id (so that auto_increment is used). GET it.

Post something that is not valid json.

Post something where the top level key is not "document" (this will fail and it is ok).

POST { "_id" : <number>, "document" : "some string"}
POST { "_id" : <number>, "document" : <number>}

POST { "_id" : <number>, "document" : {... some json...}, "metadata" : { ...more json... } } ' http://localhost:$JSON_SERVER_PORT/json?schema=json&table=anothertable

GET anothertable

# This will get the full record now, but a future feature is that the document key should not be returned with this query document.
GET { "_id" : <number>, "metadata" : null }

INSERT INTO anothertable VALUES ( <number>, "This text is not valid JSON", "Neither is this")
# Will fail but must not crash server.
GET <number from above> from anothertable

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.