diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-12-07 14:32:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 14:32:36 +0100 |
commit | 2d53be0267acc49cda46707b885096193a1f4e9c (patch) | |
tree | 887061a34bc67f40acbb96a6278f9544bf83caeb /server/tests/api/check-params/blocklist.ts | |
parent | adc1f09c0dbd997f34028c1c82d1c118dc8ead80 (diff) | |
download | PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.gz PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.zst PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.zip |
replace numbers with typed http status codes (#3409)
Diffstat (limited to 'server/tests/api/check-params/blocklist.ts')
-rw-r--r-- | server/tests/api/check-params/blocklist.ts | 77 |
1 files changed, 39 insertions, 38 deletions
diff --git a/server/tests/api/check-params/blocklist.ts b/server/tests/api/check-params/blocklist.ts index 1219ec9bd..5ed8810ce 100644 --- a/server/tests/api/check-params/blocklist.ts +++ b/server/tests/api/check-params/blocklist.ts | |||
@@ -19,6 +19,7 @@ import { | |||
19 | checkBadSortPagination, | 19 | checkBadSortPagination, |
20 | checkBadStartPagination | 20 | checkBadStartPagination |
21 | } from '../../../../shared/extra-utils/requests/check-api-params' | 21 | } from '../../../../shared/extra-utils/requests/check-api-params' |
22 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
22 | 23 | ||
23 | describe('Test blocklist API validators', function () { | 24 | describe('Test blocklist API validators', function () { |
24 | let servers: ServerInfo[] | 25 | let servers: ServerInfo[] |
@@ -53,7 +54,7 @@ describe('Test blocklist API validators', function () { | |||
53 | await makeGetRequest({ | 54 | await makeGetRequest({ |
54 | url: server.url, | 55 | url: server.url, |
55 | path, | 56 | path, |
56 | statusCodeExpected: 401 | 57 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 |
57 | }) | 58 | }) |
58 | }) | 59 | }) |
59 | 60 | ||
@@ -76,7 +77,7 @@ describe('Test blocklist API validators', function () { | |||
76 | url: server.url, | 77 | url: server.url, |
77 | path, | 78 | path, |
78 | fields: { accountName: 'user1' }, | 79 | fields: { accountName: 'user1' }, |
79 | statusCodeExpected: 401 | 80 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 |
80 | }) | 81 | }) |
81 | }) | 82 | }) |
82 | 83 | ||
@@ -86,7 +87,7 @@ describe('Test blocklist API validators', function () { | |||
86 | token: server.accessToken, | 87 | token: server.accessToken, |
87 | path, | 88 | path, |
88 | fields: { accountName: 'user2' }, | 89 | fields: { accountName: 'user2' }, |
89 | statusCodeExpected: 404 | 90 | statusCodeExpected: HttpStatusCode.NOT_FOUND_404 |
90 | }) | 91 | }) |
91 | }) | 92 | }) |
92 | 93 | ||
@@ -96,7 +97,7 @@ describe('Test blocklist API validators', function () { | |||
96 | token: server.accessToken, | 97 | token: server.accessToken, |
97 | path, | 98 | path, |
98 | fields: { accountName: 'root' }, | 99 | fields: { accountName: 'root' }, |
99 | statusCodeExpected: 409 | 100 | statusCodeExpected: HttpStatusCode.CONFLICT_409 |
100 | }) | 101 | }) |
101 | }) | 102 | }) |
102 | 103 | ||
@@ -106,7 +107,7 @@ describe('Test blocklist API validators', function () { | |||
106 | token: server.accessToken, | 107 | token: server.accessToken, |
107 | path, | 108 | path, |
108 | fields: { accountName: 'user1' }, | 109 | fields: { accountName: 'user1' }, |
109 | statusCodeExpected: 204 | 110 | statusCodeExpected: HttpStatusCode.NO_CONTENT_204 |
110 | }) | 111 | }) |
111 | }) | 112 | }) |
112 | }) | 113 | }) |
@@ -116,7 +117,7 @@ describe('Test blocklist API validators', function () { | |||
116 | await makeDeleteRequest({ | 117 | await makeDeleteRequest({ |
117 | url: server.url, | 118 | url: server.url, |
118 | path: path + '/user1', | 119 | path: path + '/user1', |
119 | statusCodeExpected: 401 | 120 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 |
120 | }) | 121 | }) |
121 | }) | 122 | }) |
122 | 123 | ||
@@ -125,7 +126,7 @@ describe('Test blocklist API validators', function () { | |||
125 | url: server.url, | 126 | url: server.url, |
126 | path: path + '/user2', | 127 | path: path + '/user2', |
127 | token: server.accessToken, | 128 | token: server.accessToken, |
128 | statusCodeExpected: 404 | 129 | statusCodeExpected: HttpStatusCode.NOT_FOUND_404 |
129 | }) | 130 | }) |
130 | }) | 131 | }) |
131 | 132 | ||
@@ -134,7 +135,7 @@ describe('Test blocklist API validators', function () { | |||
134 | url: server.url, | 135 | url: server.url, |
135 | path: path + '/user1', | 136 | path: path + '/user1', |
136 | token: server.accessToken, | 137 | token: server.accessToken, |
137 | statusCodeExpected: 204 | 138 | statusCodeExpected: HttpStatusCode.NO_CONTENT_204 |
138 | }) | 139 | }) |
139 | }) | 140 | }) |
140 | }) | 141 | }) |
@@ -148,7 +149,7 @@ describe('Test blocklist API validators', function () { | |||
148 | await makeGetRequest({ | 149 | await makeGetRequest({ |
149 | url: server.url, | 150 | url: server.url, |
150 | path, | 151 | path, |
151 | statusCodeExpected: 401 | 152 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 |
152 | }) | 153 | }) |
153 | }) | 154 | }) |
154 | 155 | ||
@@ -171,7 +172,7 @@ describe('Test blocklist API validators', function () { | |||
171 | url: server.url, | 172 | url: server.url, |
172 | path, | 173 | path, |
173 | fields: { host: 'localhost:9002' }, | 174 | fields: { host: 'localhost:9002' }, |
174 | statusCodeExpected: 401 | 175 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 |
175 | }) | 176 | }) |
176 | }) | 177 | }) |
177 | 178 | ||
@@ -181,7 +182,7 @@ describe('Test blocklist API validators', function () { | |||
181 | token: server.accessToken, | 182 | token: server.accessToken, |
182 | path, | 183 | path, |
183 | fields: { host: 'localhost:9003' }, | 184 | fields: { host: 'localhost:9003' }, |
184 | statusCodeExpected: 204 | 185 | statusCodeExpected: HttpStatusCode.NO_CONTENT_204 |
185 | }) | 186 | }) |
186 | }) | 187 | }) |
187 | 188 | ||
@@ -191,7 +192,7 @@ describe('Test blocklist API validators', function () { | |||
191 | token: server.accessToken, | 192 | token: server.accessToken, |
192 | path, | 193 | path, |
193 | fields: { host: 'localhost:' + server.port }, | 194 | fields: { host: 'localhost:' + server.port }, |
194 | statusCodeExpected: 409 | 195 | statusCodeExpected: HttpStatusCode.CONFLICT_409 |
195 | }) | 196 | }) |
196 | }) | 197 | }) |
197 | 198 | ||
@@ -201,7 +202,7 @@ describe('Test blocklist API validators', function () { | |||
201 | token: server.accessToken, | 202 | token: server.accessToken, |
202 | path, | 203 | path, |
203 | fields: { host: 'localhost:' + servers[1].port }, | 204 | fields: { host: 'localhost:' + servers[1].port }, |
204 | statusCodeExpected: 204 | 205 | statusCodeExpected: HttpStatusCode.NO_CONTENT_204 |
205 | }) | 206 | }) |
206 | }) | 207 | }) |
207 | }) | 208 | }) |
@@ -211,7 +212,7 @@ describe('Test blocklist API validators', function () { | |||
211 | await makeDeleteRequest({ | 212 | await makeDeleteRequest({ |
212 | url: server.url, | 213 | url: server.url, |
213 | path: path + '/localhost:' + servers[1].port, | 214 | path: path + '/localhost:' + servers[1].port, |
214 | statusCodeExpected: 401 | 215 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 |
215 | }) | 216 | }) |
216 | }) | 217 | }) |
217 | 218 | ||
@@ -220,7 +221,7 @@ describe('Test blocklist API validators', function () { | |||
220 | url: server.url, | 221 | url: server.url, |
221 | path: path + '/localhost:9004', | 222 | path: path + '/localhost:9004', |
222 | token: server.accessToken, | 223 | token: server.accessToken, |
223 | statusCodeExpected: 404 | 224 | statusCodeExpected: HttpStatusCode.NOT_FOUND_404 |
224 | }) | 225 | }) |
225 | }) | 226 | }) |
226 | 227 | ||
@@ -229,7 +230,7 @@ describe('Test blocklist API validators', function () { | |||
229 | url: server.url, | 230 | url: server.url, |
230 | path: path + '/localhost:' + servers[1].port, | 231 | path: path + '/localhost:' + servers[1].port, |
231 | token: server.accessToken, | 232 | token: server.accessToken, |
232 | statusCodeExpected: 204 | 233 | statusCodeExpected: HttpStatusCode.NO_CONTENT_204 |
233 | }) | 234 | }) |
234 | }) | 235 | }) |
235 | }) | 236 | }) |
@@ -246,7 +247,7 @@ describe('Test blocklist API validators', function () { | |||
246 | await makeGetRequest({ | 247 | await makeGetRequest({ |
247 | url: server.url, | 248 | url: server.url, |
248 | path, | 249 | path, |
249 | statusCodeExpected: 401 | 250 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 |
250 | }) | 251 | }) |
251 | }) | 252 | }) |
252 | 253 | ||
@@ -255,7 +256,7 @@ describe('Test blocklist API validators', function () { | |||
255 | url: server.url, | 256 | url: server.url, |
256 | token: userAccessToken, | 257 | token: userAccessToken, |
257 | path, | 258 | path, |
258 | statusCodeExpected: 403 | 259 | statusCodeExpected: HttpStatusCode.FORBIDDEN_403 |
259 | }) | 260 | }) |
260 | }) | 261 | }) |
261 | 262 | ||
@@ -278,7 +279,7 @@ describe('Test blocklist API validators', function () { | |||
278 | url: server.url, | 279 | url: server.url, |
279 | path, | 280 | path, |
280 | fields: { accountName: 'user1' }, | 281 | fields: { accountName: 'user1' }, |
281 | statusCodeExpected: 401 | 282 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 |
282 | }) | 283 | }) |
283 | }) | 284 | }) |
284 | 285 | ||
@@ -288,7 +289,7 @@ describe('Test blocklist API validators', function () { | |||
288 | token: userAccessToken, | 289 | token: userAccessToken, |
289 | path, | 290 | path, |
290 | fields: { accountName: 'user1' }, | 291 | fields: { accountName: 'user1' }, |
291 | statusCodeExpected: 403 | 292 | statusCodeExpected: HttpStatusCode.FORBIDDEN_403 |
292 | }) | 293 | }) |
293 | }) | 294 | }) |
294 | 295 | ||
@@ -298,7 +299,7 @@ describe('Test blocklist API validators', function () { | |||
298 | token: server.accessToken, | 299 | token: server.accessToken, |
299 | path, | 300 | path, |
300 | fields: { accountName: 'user2' }, | 301 | fields: { accountName: 'user2' }, |
301 | statusCodeExpected: 404 | 302 | statusCodeExpected: HttpStatusCode.NOT_FOUND_404 |
302 | }) | 303 | }) |
303 | }) | 304 | }) |
304 | 305 | ||
@@ -308,7 +309,7 @@ describe('Test blocklist API validators', function () { | |||
308 | token: server.accessToken, | 309 | token: server.accessToken, |
309 | path, | 310 | path, |
310 | fields: { accountName: 'root' }, | 311 | fields: { accountName: 'root' }, |
311 | statusCodeExpected: 409 | 312 | statusCodeExpected: HttpStatusCode.CONFLICT_409 |
312 | }) | 313 | }) |
313 | }) | 314 | }) |
314 | 315 | ||
@@ -318,7 +319,7 @@ describe('Test blocklist API validators', function () { | |||
318 | token: server.accessToken, | 319 | token: server.accessToken, |
319 | path, | 320 | path, |
320 | fields: { accountName: 'user1' }, | 321 | fields: { accountName: 'user1' }, |
321 | statusCodeExpected: 204 | 322 | statusCodeExpected: HttpStatusCode.NO_CONTENT_204 |
322 | }) | 323 | }) |
323 | }) | 324 | }) |
324 | }) | 325 | }) |
@@ -328,7 +329,7 @@ describe('Test blocklist API validators', function () { | |||
328 | await makeDeleteRequest({ | 329 | await makeDeleteRequest({ |
329 | url: server.url, | 330 | url: server.url, |
330 | path: path + '/user1', | 331 | path: path + '/user1', |
331 | statusCodeExpected: 401 | 332 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 |
332 | }) | 333 | }) |
333 | }) | 334 | }) |
334 | 335 | ||
@@ -337,7 +338,7 @@ describe('Test blocklist API validators', function () { | |||
337 | url: server.url, | 338 | url: server.url, |
338 | path: path + '/user1', | 339 | path: path + '/user1', |
339 | token: userAccessToken, | 340 | token: userAccessToken, |
340 | statusCodeExpected: 403 | 341 | statusCodeExpected: HttpStatusCode.FORBIDDEN_403 |
341 | }) | 342 | }) |
342 | }) | 343 | }) |
343 | 344 | ||
@@ -346,7 +347,7 @@ describe('Test blocklist API validators', function () { | |||
346 | url: server.url, | 347 | url: server.url, |
347 | path: path + '/user2', | 348 | path: path + '/user2', |
348 | token: server.accessToken, | 349 | token: server.accessToken, |
349 | statusCodeExpected: 404 | 350 | statusCodeExpected: HttpStatusCode.NOT_FOUND_404 |
350 | }) | 351 | }) |
351 | }) | 352 | }) |
352 | 353 | ||
@@ -355,7 +356,7 @@ describe('Test blocklist API validators', function () { | |||
355 | url: server.url, | 356 | url: server.url, |
356 | path: path + '/user1', | 357 | path: path + '/user1', |
357 | token: server.accessToken, | 358 | token: server.accessToken, |
358 | statusCodeExpected: 204 | 359 | statusCodeExpected: HttpStatusCode.NO_CONTENT_204 |
359 | }) | 360 | }) |
360 | }) | 361 | }) |
361 | }) | 362 | }) |
@@ -369,7 +370,7 @@ describe('Test blocklist API validators', function () { | |||
369 | await makeGetRequest({ | 370 | await makeGetRequest({ |
370 | url: server.url, | 371 | url: server.url, |
371 | path, | 372 | path, |
372 | statusCodeExpected: 401 | 373 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 |
373 | }) | 374 | }) |
374 | }) | 375 | }) |
375 | 376 | ||
@@ -378,7 +379,7 @@ describe('Test blocklist API validators', function () { | |||
378 | url: server.url, | 379 | url: server.url, |
379 | token: userAccessToken, | 380 | token: userAccessToken, |
380 | path, | 381 | path, |
381 | statusCodeExpected: 403 | 382 | statusCodeExpected: HttpStatusCode.FORBIDDEN_403 |
382 | }) | 383 | }) |
383 | }) | 384 | }) |
384 | 385 | ||
@@ -401,7 +402,7 @@ describe('Test blocklist API validators', function () { | |||
401 | url: server.url, | 402 | url: server.url, |
402 | path, | 403 | path, |
403 | fields: { host: 'localhost:' + servers[1].port }, | 404 | fields: { host: 'localhost:' + servers[1].port }, |
404 | statusCodeExpected: 401 | 405 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 |
405 | }) | 406 | }) |
406 | }) | 407 | }) |
407 | 408 | ||
@@ -411,7 +412,7 @@ describe('Test blocklist API validators', function () { | |||
411 | token: userAccessToken, | 412 | token: userAccessToken, |
412 | path, | 413 | path, |
413 | fields: { host: 'localhost:' + servers[1].port }, | 414 | fields: { host: 'localhost:' + servers[1].port }, |
414 | statusCodeExpected: 403 | 415 | statusCodeExpected: HttpStatusCode.FORBIDDEN_403 |
415 | }) | 416 | }) |
416 | }) | 417 | }) |
417 | 418 | ||
@@ -421,7 +422,7 @@ describe('Test blocklist API validators', function () { | |||
421 | token: server.accessToken, | 422 | token: server.accessToken, |
422 | path, | 423 | path, |
423 | fields: { host: 'localhost:9003' }, | 424 | fields: { host: 'localhost:9003' }, |
424 | statusCodeExpected: 204 | 425 | statusCodeExpected: HttpStatusCode.NO_CONTENT_204 |
425 | }) | 426 | }) |
426 | }) | 427 | }) |
427 | 428 | ||
@@ -431,7 +432,7 @@ describe('Test blocklist API validators', function () { | |||
431 | token: server.accessToken, | 432 | token: server.accessToken, |
432 | path, | 433 | path, |
433 | fields: { host: 'localhost:' + server.port }, | 434 | fields: { host: 'localhost:' + server.port }, |
434 | statusCodeExpected: 409 | 435 | statusCodeExpected: HttpStatusCode.CONFLICT_409 |
435 | }) | 436 | }) |
436 | }) | 437 | }) |
437 | 438 | ||
@@ -441,7 +442,7 @@ describe('Test blocklist API validators', function () { | |||
441 | token: server.accessToken, | 442 | token: server.accessToken, |
442 | path, | 443 | path, |
443 | fields: { host: 'localhost:' + servers[1].port }, | 444 | fields: { host: 'localhost:' + servers[1].port }, |
444 | statusCodeExpected: 204 | 445 | statusCodeExpected: HttpStatusCode.NO_CONTENT_204 |
445 | }) | 446 | }) |
446 | }) | 447 | }) |
447 | }) | 448 | }) |
@@ -451,7 +452,7 @@ describe('Test blocklist API validators', function () { | |||
451 | await makeDeleteRequest({ | 452 | await makeDeleteRequest({ |
452 | url: server.url, | 453 | url: server.url, |
453 | path: path + '/localhost:' + servers[1].port, | 454 | path: path + '/localhost:' + servers[1].port, |
454 | statusCodeExpected: 401 | 455 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 |
455 | }) | 456 | }) |
456 | }) | 457 | }) |
457 | 458 | ||
@@ -460,7 +461,7 @@ describe('Test blocklist API validators', function () { | |||
460 | url: server.url, | 461 | url: server.url, |
461 | path: path + '/localhost:' + servers[1].port, | 462 | path: path + '/localhost:' + servers[1].port, |
462 | token: userAccessToken, | 463 | token: userAccessToken, |
463 | statusCodeExpected: 403 | 464 | statusCodeExpected: HttpStatusCode.FORBIDDEN_403 |
464 | }) | 465 | }) |
465 | }) | 466 | }) |
466 | 467 | ||
@@ -469,7 +470,7 @@ describe('Test blocklist API validators', function () { | |||
469 | url: server.url, | 470 | url: server.url, |
470 | path: path + '/localhost:9004', | 471 | path: path + '/localhost:9004', |
471 | token: server.accessToken, | 472 | token: server.accessToken, |
472 | statusCodeExpected: 404 | 473 | statusCodeExpected: HttpStatusCode.NOT_FOUND_404 |
473 | }) | 474 | }) |
474 | }) | 475 | }) |
475 | 476 | ||
@@ -478,7 +479,7 @@ describe('Test blocklist API validators', function () { | |||
478 | url: server.url, | 479 | url: server.url, |
479 | path: path + '/localhost:' + servers[1].port, | 480 | path: path + '/localhost:' + servers[1].port, |
480 | token: server.accessToken, | 481 | token: server.accessToken, |
481 | statusCodeExpected: 204 | 482 | statusCodeExpected: HttpStatusCode.NO_CONTENT_204 |
482 | }) | 483 | }) |
483 | }) | 484 | }) |
484 | }) | 485 | }) |