From f1273314593a4a7dc7ec9594ce0c6c3ae8f62b34 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 16 Nov 2020 11:55:17 +0100 Subject: Add admin view to manage comments --- server/tests/api/check-params/video-comments.ts | 48 +++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'server/tests/api/check-params/video-comments.ts') 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 () { it('Should return conflict on comment thread add') }) + describe('When listing admin comments threads', function () { + const path = '/api/v1/videos/comments' + + it('Should fail with a bad start pagination', async function () { + await checkBadStartPagination(server.url, path, server.accessToken) + }) + + it('Should fail with a bad count pagination', async function () { + await checkBadCountPagination(server.url, path, server.accessToken) + }) + + it('Should fail with an incorrect sort', async function () { + await checkBadSortPagination(server.url, path, server.accessToken) + }) + + it('Should fail with a non authenticated user', async function () { + await makeGetRequest({ + url: server.url, + path, + statusCodeExpected: 401 + }) + }) + + it('Should fail with a non admin user', async function () { + await makeGetRequest({ + url: server.url, + path, + token: userAccessToken, + statusCodeExpected: 403 + }) + }) + + it('Should succeed with the correct params', async function () { + await makeGetRequest({ + url: server.url, + path, + token: server.accessToken, + query: { + isLocal: false, + search: 'toto', + searchAccount: 'toto', + searchVideo: 'toto' + }, + statusCodeExpected: 200 + }) + }) + }) + after(async function () { await cleanupTests([ server ]) }) -- cgit v1.2.3