]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/check-params/video-comments.ts
Filter on follows actor types in about page
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / video-comments.ts
index 3fde9bd947f8e6c272f6449da7cf52fe6654e9f9..5cf90bacc25407fde6b9a44de5a529b0182bdbb6 100644 (file)
@@ -3,12 +3,23 @@
 import * as chai from 'chai'
 import 'mocha'
 import {
+  cleanupTests,
   createUser,
-  flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers,
-  uploadVideo, userLogin
-} from '../../utils'
-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
-import { addVideoCommentThread } from '../../utils/videos/video-comments'
+  flushAndRunServer,
+  makeDeleteRequest,
+  makeGetRequest,
+  makePostBodyRequest,
+  ServerInfo,
+  setAccessTokensToServers,
+  uploadVideo,
+  userLogin
+} from '../../../../shared/extra-utils'
+import {
+  checkBadCountPagination,
+  checkBadSortPagination,
+  checkBadStartPagination
+} from '../../../../shared/extra-utils/requests/check-api-params'
+import { addVideoCommentThread } from '../../../../shared/extra-utils/videos/video-comments'
 
 const expect = chai.expect
 
@@ -25,9 +36,7 @@ describe('Test video comments API validator', function () {
   before(async function () {
     this.timeout(30000)
 
-    await flushTests()
-
-    server = await runServer(1)
+    server = await flushAndRunServer(1)
 
     await setAccessTokensToServers([ server ])
 
@@ -48,7 +57,7 @@ describe('Test video comments API validator', function () {
         username: 'user1',
         password: 'my super password'
       }
-      await createUser(server.url, server.accessToken, user.username, user.password)
+      await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
       userAccessToken = await userLogin(server, user)
     }
   })
@@ -117,7 +126,7 @@ describe('Test video comments API validator', function () {
 
     it('Should fail with a short comment', async function () {
       const fields = {
-        text: 'h'.repeat(3001)
+        text: ''
       }
       await makePostBodyRequest({ url: server.url, path: pathThread, token: server.accessToken, fields })
     })
@@ -160,7 +169,7 @@ describe('Test video comments API validator', function () {
 
     it('Should fail with a short comment', async function () {
       const fields = {
-        text: 'h'.repeat(3001)
+        text: ''
       }
       await makePostBodyRequest({ url: server.url, path: pathComment, token: server.accessToken, fields })
     })
@@ -250,11 +259,6 @@ describe('Test video comments API validator', function () {
   })
 
   after(async function () {
-    killallServers([ server ])
-
-    // Keep the logs if the test failed
-    if (this['ok']) {
-      await flushTests()
-    }
+    await cleanupTests([ server ])
   })
 })