This repository has been archived by the owner on Aug 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from ncrmro/dev
Adds solid graphql enpoint testing and coverage support
- Loading branch information
Showing
4 changed files
with
111 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
machine: | ||
python: | ||
version: 3.5.2 | ||
general: | ||
artifacts: | ||
- ".coverage" | ||
dependencies: | ||
post: | ||
- pip install -r ./deps/testing.txt | ||
test: | ||
override: | ||
- ./src/manage.py test ./src | ||
- coverage run --source='.' ./src/manage.py test ./src |
This file contains 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 characters
This file contains 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 characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Todos App | ||
You may use graphiql or curl to try out some of the queries. | ||
|
||
## Queries | ||
The following is an example query to get the first ten todos and | ||
return the id and text of each one. | ||
``` | ||
query { | ||
allTodos(first: 10){ | ||
edges{ | ||
node{ | ||
id, | ||
text | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
The response | ||
``` | ||
{ | ||
"data": { | ||
"allTodos": { | ||
"edges": [ | ||
{ | ||
"node": { | ||
"id": "VG9kb05vZGU6MQ==", | ||
"text": "adfasdfdsa" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Queries with Variables | ||
``` | ||
query getSomeTodos($todos_count: Int!) { | ||
allTodos(first: $todos_count) { | ||
edges { | ||
node { | ||
id | ||
text | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
### Using Curl | ||
The actual post request is a json string to be careful of empty space or new lines. | ||
Running the example query again would look like this | ||
``` | ||
curl -XPOST -H 'Content-Type:application/graphql' \ | ||
-d '{ allTodos(first: 10){edges{node{id,text}}}}' \ | ||
http://localhost:8000/graphql | ||
``` | ||
And return the following data. | ||
``` | ||
{"data":{"allTodos":{"edges":[{"node":{"id":"VG9kb05vZGU6MQ==","text":"adsfasdfasdfsd"}},{"node":{"id":"VG9kb05vZGU6Mg==","text":"adsfadsfa"}}]}}} | ||
``` | ||
|
||
### Using CocoaRestClient GUI /JSON Body | ||
This is a valid json body you can paste into the raw input of the coca rest client. | ||
`{"query": "query {allTodos(first: 10){edges{node{id,text}}}}"}` | ||
|
||
## Mutations | ||
|
||
|
This file contains 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 characters