diff options
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r-- | server/tests/api/check-params/users.ts | 12 | ||||
-rw-r--r-- | server/tests/api/check-params/video-comments.ts | 48 |
2 files changed, 48 insertions, 12 deletions
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts index 3e53c445d..2a220be83 100644 --- a/server/tests/api/check-params/users.ts +++ b/server/tests/api/check-params/users.ts | |||
@@ -154,18 +154,6 @@ describe('Test users API validators', function () { | |||
154 | await checkBadSortPagination(server.url, path, server.accessToken) | 154 | await checkBadSortPagination(server.url, path, server.accessToken) |
155 | }) | 155 | }) |
156 | 156 | ||
157 | it('Should fail with a bad blocked/banned user filter', async function () { | ||
158 | await makeGetRequest({ | ||
159 | url: server.url, | ||
160 | path, | ||
161 | query: { | ||
162 | blocked: 42 | ||
163 | }, | ||
164 | token: server.accessToken, | ||
165 | statusCodeExpected: 400 | ||
166 | }) | ||
167 | }) | ||
168 | |||
169 | it('Should fail with a non authenticated user', async function () { | 157 | it('Should fail with a non authenticated user', async function () { |
170 | await makeGetRequest({ | 158 | await makeGetRequest({ |
171 | url: server.url, | 159 | url: server.url, |
diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts index 181282ce1..662d4a70d 100644 --- a/server/tests/api/check-params/video-comments.ts +++ b/server/tests/api/check-params/video-comments.ts | |||
@@ -296,6 +296,54 @@ describe('Test video comments API validator', function () { | |||
296 | it('Should return conflict on comment thread add') | 296 | it('Should return conflict on comment thread add') |
297 | }) | 297 | }) |
298 | 298 | ||
299 | describe('When listing admin comments threads', function () { | ||
300 | const path = '/api/v1/videos/comments' | ||
301 | |||
302 | it('Should fail with a bad start pagination', async function () { | ||
303 | await checkBadStartPagination(server.url, path, server.accessToken) | ||
304 | }) | ||
305 | |||
306 | it('Should fail with a bad count pagination', async function () { | ||
307 | await checkBadCountPagination(server.url, path, server.accessToken) | ||
308 | }) | ||
309 | |||
310 | it('Should fail with an incorrect sort', async function () { | ||
311 | await checkBadSortPagination(server.url, path, server.accessToken) | ||
312 | }) | ||
313 | |||
314 | it('Should fail with a non authenticated user', async function () { | ||
315 | await makeGetRequest({ | ||
316 | url: server.url, | ||
317 | path, | ||
318 | statusCodeExpected: 401 | ||
319 | }) | ||
320 | }) | ||
321 | |||
322 | it('Should fail with a non admin user', async function () { | ||
323 | await makeGetRequest({ | ||
324 | url: server.url, | ||
325 | path, | ||
326 | token: userAccessToken, | ||
327 | statusCodeExpected: 403 | ||
328 | }) | ||
329 | }) | ||
330 | |||
331 | it('Should succeed with the correct params', async function () { | ||
332 | await makeGetRequest({ | ||
333 | url: server.url, | ||
334 | path, | ||
335 | token: server.accessToken, | ||
336 | query: { | ||
337 | isLocal: false, | ||
338 | search: 'toto', | ||
339 | searchAccount: 'toto', | ||
340 | searchVideo: 'toto' | ||
341 | }, | ||
342 | statusCodeExpected: 200 | ||
343 | }) | ||
344 | }) | ||
345 | }) | ||
346 | |||
299 | after(async function () { | 347 | after(async function () { |
300 | await cleanupTests([ server ]) | 348 | await cleanupTests([ server ]) |
301 | }) | 349 | }) |