]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/check-params/video-comments.ts
Add admin view to manage comments
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / video-comments.ts
index 181282ce15df73cfb4e2b6bb92dc44ac11ee9b97..662d4a70d3981fc144b8ae4678f2b718dd5d19b8 100644 (file)
@@ -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 ])
   })