forked from GeoNode/geonode-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.scenarios.yml
149 lines (149 loc) · 4.28 KB
/
tests.scenarios.yml
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
{
"scenarioVersion": "1.1",
"name": "Datasets API Tests",
"description": "**These scenarios test the Datasets API described in the main.oas2 file (linked in left file tree).**\n\nThe settings in the \"Swagger/OAS Coverage\" section linked in the editor sidebar automatically add contract testing when we run this collection.\n\n**Don’t forget to set the two environment variables below, where the orange exlamation point is!!**\n\n*host:* http://api.geonode.org\n\n*datasetsApiKey:* 123\n\n**After setting the environment variables, click “Run Collection” at the top of the editor.**\n\nNote: some tests will fail. This is because the main.oas2 file describes a required user property that the API does not actually return. Try removing that property from the main.oas2 file, saving it, and then re-running these scenarios.",
"settings": {
"testing": {
"oas2": [
"./main.oas2.yml"
]
}
},
"before": {},
"scenarios": {
"dataset-crud": {
"name": "Dataset CRUD",
"steps": [
{
"type": "http",
"name": "Create Dataset",
"input": {
"method": "post",
"url": "{$$.env.host}/datasets",
"body": {
"name": "string",
"completed": [
"boolean",
"null"
]
},
"headers": {
"Content-Type": "application/json"
},
"query": {
"apikey": "{$$.env.datasetsApiKey}"
}
},
"after": {
"assertions": [
{
"target": "output.status",
"op": "eq",
"expected": 201
}
],
"transforms": [
{
"target": "$.ctx.datasetUuid",
"source": "output.body.uuid"
}
]
}
},
{
"type": "http",
"name": "Get Dataset",
"input": {
"method": "get",
"url": "{$$.env.host}/datasets/{$.ctx.datasetUuid}"
},
"after": {
"assertions": [
{
"target": "output.status",
"op": "eq",
"expected": 200
}
],
"transforms": [
{
"target": "$.ctx.datasetUuid",
"source": "output.body.uuid"
}
]
}
},
{
"type": "http",
"name": "Update Dataset",
"input": {
"method": "put",
"url": "{$$.env.host}/datasets/{$.ctx.datasetUuid}?apikey={$$.env.datasetsApiKey}",
"body": {
"name": "string",
"completed": [
"boolean",
"null"
]
},
"headers": {
"Content-Type": "application/json"
}
},
"after": {
"assertions": [
{
"target": "output.status",
"op": "eq",
"expected": 200
}
]
}
},
{
"type": "http",
"name": "Delete Dataset",
"input": {
"method": "delete",
"url": "{$$.env.host}/datasets/{$.ctx.datasetUuid}?apikey={$$.env.datasetsApiKey}"
},
"after": {
"assertions": [
{
"target": "output.status",
"op": "eq",
"expected": 204
}
]
}
},
{
"type": "http",
"name": "Make Sure Deleted",
"description": "We should get a 404 back after deleting.",
"input": {
"method": "get",
"url": "{$$.env.host}/datasets/{$.ctx.datasetUuid}",
"query": {
"apikey": "{$$.env.apikey}"
},
"params": {
"datasetUuid": ""
}
},
"after": {
"assertions": [
{
"target": "output.status",
"op": "eq",
"expected": 404
}
]
}
}
]
}
},
"after": {},
"utilities": {}
}