-
Notifications
You must be signed in to change notification settings - Fork 2
/
SWAPI.postman_collection.json
70 lines (70 loc) · 2 KB
/
SWAPI.postman_collection.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{
"info": {
"_postman_id": "5df9a536-e13e-4673-ae51-01abea4a2a2b",
"name": "SWAPI",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "POST SWAPI GraphQL",
"event": [
{
"listen": "test",
"script": {
"id": "ae3aa425-ec6e-4660-9d48-788d3b93bc2b",
"exec": [
"pm.test(\"Response time is less than 200ms\", function () {",
" pm.expect(pm.response.responseTime).to.be.below(200);",
"});",
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Response does not error\", function() {",
" pm.response.to.not.be.error;",
" pm.response.to.not.have.jsonBody(\"error\");",
"});",
"pm.test(\"Response must be valid and have a body\", function() {",
" pm.response.to.be.json; // this assertion checks if a body exists",
"});",
"var jsonData = pm.response.json();",
"pm.test(\"Has correct schema\", function() {",
" pm.expect(jsonData.data.allFilms.films).to.be.a(\"array\");",
" _.each(jsonData.data.allFilms.films, (film) => {",
" pm.expect(film.id).to.be.a(\"string\", \"Film ID not string.\");",
" pm.expect(film.title).to.be.a(\"string\", \"Film Title not string.\");",
" pm.expect(film.episodeID).to.be.a(\"number\", \"Film Episode ID not number.\");",
" })",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "graphql",
"graphql": {
"query": "query{\n allFilms\n {\n films {\n id\n title\n episodeID\n }\n }\n}",
"variables": ""
}
},
"url": {
"raw": "https://swapi.apis.guru/",
"protocol": "https",
"host": [
"swapi",
"apis",
"guru"
],
"path": [
""
]
}
},
"response": []
}
]
}