-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTradeOffStackAPI_Tests_Automatises.postman_collection.json
More file actions
209 lines (209 loc) · 4.12 KB
/
Copy pathTradeOffStackAPI_Tests_Automatises.postman_collection.json
File metadata and controls
209 lines (209 loc) · 4.12 KB
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
{
"info": {
"_postman_id": "4b9f2b8f-1a9a-4c9b-b9f1-a1b2c3d4e5f6",
"name": "TradeOffStack API Automatisé",
"description": "Collection de tests bout-en-bout pour TradeOffStack API (Production / Docker)",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "1. Authentication",
"item": [
{
"name": "Login Admin",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"var jsonData = pm.response.json();",
"if(jsonData.token) {",
" pm.environment.set(\"jwt_token\", jsonData.token);",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"admin@tradeoffstack.com\",\n \"password\": \"Admin123!Secure\"\n}"
},
"url": {
"raw": "{{base_url}}/api/Auth/login",
"host": [
"{{base_url}}"
],
"path": [
"api",
"Auth",
"login"
]
}
}
}
]
},
{
"name": "2. Departments (CRUD)",
"item": [
{
"name": "Create Department",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 200/201\", function () {",
" pm.response.to.be.success;",
"});",
"",
"var jsonData = pm.response.json();",
"if(jsonData.id) {",
" pm.environment.set(\"department_id\", jsonData.id);",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"Département Informatique\",\n \"description\": \"Gestion de l'IT et des équipements\"\n}"
},
"url": {
"raw": "{{base_url}}/api/Departments",
"host": [
"{{base_url}}"
],
"path": [
"api",
"Departments"
]
}
}
},
{
"name": "Get Department By ID",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{base_url}}/api/Departments/{{department_id}}",
"host": [
"{{base_url}}"
],
"path": [
"api",
"Departments",
"{{department_id}}"
]
}
}
},
{
"name": "Update Department",
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"Département Informatique (Mise à jour)\",\n \"description\": \"Nouveau nom pour les tests\"\n}"
},
"url": {
"raw": "{{base_url}}/api/Departments/{{department_id}}",
"host": [
"{{base_url}}"
],
"path": [
"api",
"Departments",
"{{department_id}}"
]
}
}
},
{
"name": "Delete Department",
"request": {
"method": "DELETE",
"header": [],
"url": {
"raw": "{{base_url}}/api/Departments/{{department_id}}",
"host": [
"{{base_url}}"
],
"path": [
"api",
"Departments",
"{{department_id}}"
]
}
}
}
]
}
],
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{jwt_token}}",
"type": "string"
}
]
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
],
"variable": [
{
"key": "base_url",
"value": "http://localhost:5000",
"type": "string"
}
]
}