diff options
Diffstat (limited to 'server/tests/api/check-params/follows.ts')
-rw-r--r-- | server/tests/api/check-params/follows.ts | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.ts index 2c2224a45..c03dd5c9c 100644 --- a/server/tests/api/check-params/follows.ts +++ b/server/tests/api/check-params/follows.ts | |||
@@ -17,6 +17,7 @@ import { | |||
17 | checkBadSortPagination, | 17 | checkBadSortPagination, |
18 | checkBadStartPagination | 18 | checkBadStartPagination |
19 | } from '../../../../shared/extra-utils/requests/check-api-params' | 19 | } from '../../../../shared/extra-utils/requests/check-api-params' |
20 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
20 | 21 | ||
21 | describe('Test server follows API validators', function () { | 22 | describe('Test server follows API validators', function () { |
22 | let server: ServerInfo | 23 | let server: ServerInfo |
@@ -52,7 +53,7 @@ describe('Test server follows API validators', function () { | |||
52 | url: server.url, | 53 | url: server.url, |
53 | path, | 54 | path, |
54 | token: server.accessToken, | 55 | token: server.accessToken, |
55 | statusCodeExpected: 400 | 56 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 |
56 | }) | 57 | }) |
57 | }) | 58 | }) |
58 | 59 | ||
@@ -62,7 +63,7 @@ describe('Test server follows API validators', function () { | |||
62 | path, | 63 | path, |
63 | token: server.accessToken, | 64 | token: server.accessToken, |
64 | fields: { hosts: 'localhost:9002' }, | 65 | fields: { hosts: 'localhost:9002' }, |
65 | statusCodeExpected: 400 | 66 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 |
66 | }) | 67 | }) |
67 | }) | 68 | }) |
68 | 69 | ||
@@ -72,7 +73,7 @@ describe('Test server follows API validators', function () { | |||
72 | path, | 73 | path, |
73 | fields: { hosts: [ 'localhost:9002', 'localhost:coucou' ] }, | 74 | fields: { hosts: [ 'localhost:9002', 'localhost:coucou' ] }, |
74 | token: server.accessToken, | 75 | token: server.accessToken, |
75 | statusCodeExpected: 400 | 76 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 |
76 | }) | 77 | }) |
77 | }) | 78 | }) |
78 | 79 | ||
@@ -82,7 +83,7 @@ describe('Test server follows API validators', function () { | |||
82 | path, | 83 | path, |
83 | fields: { hosts: [ 'localhost:9002', 'http://localhost:9003' ] }, | 84 | fields: { hosts: [ 'localhost:9002', 'http://localhost:9003' ] }, |
84 | token: server.accessToken, | 85 | token: server.accessToken, |
85 | statusCodeExpected: 400 | 86 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 |
86 | }) | 87 | }) |
87 | }) | 88 | }) |
88 | 89 | ||
@@ -92,7 +93,7 @@ describe('Test server follows API validators', function () { | |||
92 | path, | 93 | path, |
93 | fields: { urls: [ 'localhost:9002', 'localhost:9002' ] }, | 94 | fields: { urls: [ 'localhost:9002', 'localhost:9002' ] }, |
94 | token: server.accessToken, | 95 | token: server.accessToken, |
95 | statusCodeExpected: 400 | 96 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 |
96 | }) | 97 | }) |
97 | }) | 98 | }) |
98 | 99 | ||
@@ -102,7 +103,7 @@ describe('Test server follows API validators', function () { | |||
102 | path, | 103 | path, |
103 | fields: { hosts: [ 'localhost:9002' ] }, | 104 | fields: { hosts: [ 'localhost:9002' ] }, |
104 | token: 'fake_token', | 105 | token: 'fake_token', |
105 | statusCodeExpected: 401 | 106 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 |
106 | }) | 107 | }) |
107 | }) | 108 | }) |
108 | 109 | ||
@@ -112,7 +113,7 @@ describe('Test server follows API validators', function () { | |||
112 | path, | 113 | path, |
113 | fields: { hosts: [ 'localhost:9002' ] }, | 114 | fields: { hosts: [ 'localhost:9002' ] }, |
114 | token: userAccessToken, | 115 | token: userAccessToken, |
115 | statusCodeExpected: 403 | 116 | statusCodeExpected: HttpStatusCode.FORBIDDEN_403 |
116 | }) | 117 | }) |
117 | }) | 118 | }) |
118 | }) | 119 | }) |
@@ -156,7 +157,7 @@ describe('Test server follows API validators', function () { | |||
156 | await makeGetRequest({ | 157 | await makeGetRequest({ |
157 | url: server.url, | 158 | url: server.url, |
158 | path, | 159 | path, |
159 | statusCodeExpected: 200, | 160 | statusCodeExpected: HttpStatusCode.OK_200, |
160 | query: { | 161 | query: { |
161 | state: 'accepted', | 162 | state: 'accepted', |
162 | actorType: 'Application' | 163 | actorType: 'Application' |
@@ -205,7 +206,7 @@ describe('Test server follows API validators', function () { | |||
205 | await makeGetRequest({ | 206 | await makeGetRequest({ |
206 | url: server.url, | 207 | url: server.url, |
207 | path, | 208 | path, |
208 | statusCodeExpected: 200, | 209 | statusCodeExpected: HttpStatusCode.OK_200, |
209 | query: { | 210 | query: { |
210 | state: 'accepted' | 211 | state: 'accepted' |
211 | } | 212 | } |
@@ -221,7 +222,7 @@ describe('Test server follows API validators', function () { | |||
221 | url: server.url, | 222 | url: server.url, |
222 | path: path + '/toto@localhost:9002', | 223 | path: path + '/toto@localhost:9002', |
223 | token: 'fake_token', | 224 | token: 'fake_token', |
224 | statusCodeExpected: 401 | 225 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 |
225 | }) | 226 | }) |
226 | }) | 227 | }) |
227 | 228 | ||
@@ -230,7 +231,7 @@ describe('Test server follows API validators', function () { | |||
230 | url: server.url, | 231 | url: server.url, |
231 | path: path + '/toto@localhost:9002', | 232 | path: path + '/toto@localhost:9002', |
232 | token: userAccessToken, | 233 | token: userAccessToken, |
233 | statusCodeExpected: 403 | 234 | statusCodeExpected: HttpStatusCode.FORBIDDEN_403 |
234 | }) | 235 | }) |
235 | }) | 236 | }) |
236 | 237 | ||
@@ -239,7 +240,7 @@ describe('Test server follows API validators', function () { | |||
239 | url: server.url, | 240 | url: server.url, |
240 | path: path + '/toto', | 241 | path: path + '/toto', |
241 | token: server.accessToken, | 242 | token: server.accessToken, |
242 | statusCodeExpected: 400 | 243 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 |
243 | }) | 244 | }) |
244 | }) | 245 | }) |
245 | 246 | ||
@@ -248,7 +249,7 @@ describe('Test server follows API validators', function () { | |||
248 | url: server.url, | 249 | url: server.url, |
249 | path: path + '/toto@localhost:9003', | 250 | path: path + '/toto@localhost:9003', |
250 | token: server.accessToken, | 251 | token: server.accessToken, |
251 | statusCodeExpected: 404 | 252 | statusCodeExpected: HttpStatusCode.NOT_FOUND_404 |
252 | }) | 253 | }) |
253 | }) | 254 | }) |
254 | }) | 255 | }) |
@@ -261,7 +262,7 @@ describe('Test server follows API validators', function () { | |||
261 | url: server.url, | 262 | url: server.url, |
262 | path: path + '/toto@localhost:9002/accept', | 263 | path: path + '/toto@localhost:9002/accept', |
263 | token: 'fake_token', | 264 | token: 'fake_token', |
264 | statusCodeExpected: 401 | 265 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 |
265 | }) | 266 | }) |
266 | }) | 267 | }) |
267 | 268 | ||
@@ -270,7 +271,7 @@ describe('Test server follows API validators', function () { | |||
270 | url: server.url, | 271 | url: server.url, |
271 | path: path + '/toto@localhost:9002/accept', | 272 | path: path + '/toto@localhost:9002/accept', |
272 | token: userAccessToken, | 273 | token: userAccessToken, |
273 | statusCodeExpected: 403 | 274 | statusCodeExpected: HttpStatusCode.FORBIDDEN_403 |
274 | }) | 275 | }) |
275 | }) | 276 | }) |
276 | 277 | ||
@@ -279,7 +280,7 @@ describe('Test server follows API validators', function () { | |||
279 | url: server.url, | 280 | url: server.url, |
280 | path: path + '/toto/accept', | 281 | path: path + '/toto/accept', |
281 | token: server.accessToken, | 282 | token: server.accessToken, |
282 | statusCodeExpected: 400 | 283 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 |
283 | }) | 284 | }) |
284 | }) | 285 | }) |
285 | 286 | ||
@@ -288,7 +289,7 @@ describe('Test server follows API validators', function () { | |||
288 | url: server.url, | 289 | url: server.url, |
289 | path: path + '/toto@localhost:9003/accept', | 290 | path: path + '/toto@localhost:9003/accept', |
290 | token: server.accessToken, | 291 | token: server.accessToken, |
291 | statusCodeExpected: 404 | 292 | statusCodeExpected: HttpStatusCode.NOT_FOUND_404 |
292 | }) | 293 | }) |
293 | }) | 294 | }) |
294 | }) | 295 | }) |
@@ -301,7 +302,7 @@ describe('Test server follows API validators', function () { | |||
301 | url: server.url, | 302 | url: server.url, |
302 | path: path + '/toto@localhost:9002/reject', | 303 | path: path + '/toto@localhost:9002/reject', |
303 | token: 'fake_token', | 304 | token: 'fake_token', |
304 | statusCodeExpected: 401 | 305 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 |
305 | }) | 306 | }) |
306 | }) | 307 | }) |
307 | 308 | ||
@@ -310,7 +311,7 @@ describe('Test server follows API validators', function () { | |||
310 | url: server.url, | 311 | url: server.url, |
311 | path: path + '/toto@localhost:9002/reject', | 312 | path: path + '/toto@localhost:9002/reject', |
312 | token: userAccessToken, | 313 | token: userAccessToken, |
313 | statusCodeExpected: 403 | 314 | statusCodeExpected: HttpStatusCode.FORBIDDEN_403 |
314 | }) | 315 | }) |
315 | }) | 316 | }) |
316 | 317 | ||
@@ -319,7 +320,7 @@ describe('Test server follows API validators', function () { | |||
319 | url: server.url, | 320 | url: server.url, |
320 | path: path + '/toto/reject', | 321 | path: path + '/toto/reject', |
321 | token: server.accessToken, | 322 | token: server.accessToken, |
322 | statusCodeExpected: 400 | 323 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 |
323 | }) | 324 | }) |
324 | }) | 325 | }) |
325 | 326 | ||
@@ -328,7 +329,7 @@ describe('Test server follows API validators', function () { | |||
328 | url: server.url, | 329 | url: server.url, |
329 | path: path + '/toto@localhost:9003/reject', | 330 | path: path + '/toto@localhost:9003/reject', |
330 | token: server.accessToken, | 331 | token: server.accessToken, |
331 | statusCodeExpected: 404 | 332 | statusCodeExpected: HttpStatusCode.NOT_FOUND_404 |
332 | }) | 333 | }) |
333 | }) | 334 | }) |
334 | }) | 335 | }) |
@@ -341,7 +342,7 @@ describe('Test server follows API validators', function () { | |||
341 | url: server.url, | 342 | url: server.url, |
342 | path: path + '/localhost:9002', | 343 | path: path + '/localhost:9002', |
343 | token: 'fake_token', | 344 | token: 'fake_token', |
344 | statusCodeExpected: 401 | 345 | statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 |
345 | }) | 346 | }) |
346 | }) | 347 | }) |
347 | 348 | ||
@@ -350,7 +351,7 @@ describe('Test server follows API validators', function () { | |||
350 | url: server.url, | 351 | url: server.url, |
351 | path: path + '/localhost:9002', | 352 | path: path + '/localhost:9002', |
352 | token: userAccessToken, | 353 | token: userAccessToken, |
353 | statusCodeExpected: 403 | 354 | statusCodeExpected: HttpStatusCode.FORBIDDEN_403 |
354 | }) | 355 | }) |
355 | }) | 356 | }) |
356 | 357 | ||
@@ -359,7 +360,7 @@ describe('Test server follows API validators', function () { | |||
359 | url: server.url, | 360 | url: server.url, |
360 | path: path + '/example.com', | 361 | path: path + '/example.com', |
361 | token: server.accessToken, | 362 | token: server.accessToken, |
362 | statusCodeExpected: 404 | 363 | statusCodeExpected: HttpStatusCode.NOT_FOUND_404 |
363 | }) | 364 | }) |
364 | }) | 365 | }) |
365 | }) | 366 | }) |