]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/server/bulk.ts
Introduce abuse command
[github/Chocobozzz/PeerTube.git] / server / tests / api / server / bulk.ts
index 63321d4bb77166124d7e864b5a0d9b063209a238..ca98a2eb2c448f74d260438a1eb57e6011adad6b 100644 (file)
@@ -2,12 +2,14 @@
 
 import 'mocha'
 import * as chai from 'chai'
-import { VideoComment } from '@shared/models/videos/video-comment.model'
+import { Video, VideoComment } from '@shared/models'
 import {
+  addVideoCommentReply,
   addVideoCommentThread,
-  bulkRemoveCommentsOf,
+  BulkCommand,
   cleanupTests,
   createUser,
+  doubleFollow,
   flushAndRunMultipleServers,
   getVideoCommentThreads,
   getVideosList,
@@ -15,11 +17,8 @@ import {
   setAccessTokensToServers,
   uploadVideo,
   userLogin,
-  waitJobs,
-  addVideoCommentReply
+  waitJobs
 } from '../../../../shared/extra-utils/index'
-import { doubleFollow } from '../../../../shared/extra-utils/server/follows'
-import { Video } from '@shared/models'
 
 const expect = chai.expect
 
@@ -31,6 +30,8 @@ describe('Test bulk actions', function () {
   let user2AccessToken: string
   let user3AccessToken: string
 
+  let bulkCommand: BulkCommand
+
   before(async function () {
     this.timeout(30000)
 
@@ -61,6 +62,8 @@ describe('Test bulk actions', function () {
     }
 
     await doubleFollow(servers[0], servers[1])
+
+    bulkCommand = new BulkCommand(servers[0])
   })
 
   describe('Bulk remove comments', function () {
@@ -99,7 +102,7 @@ describe('Test bulk actions', function () {
     }
 
     before(async function () {
-      this.timeout(60000)
+      this.timeout(120000)
 
       await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video 1 server 1' })
       await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video 2 server 1' })
@@ -134,8 +137,7 @@ describe('Test bulk actions', function () {
     it('Should delete comments of an account on my videos', async function () {
       this.timeout(60000)
 
-      await bulkRemoveCommentsOf({
-        url: servers[0].url,
+      await bulkCommand.removeCommentsOf({
         token: user1AccessToken,
         attributes: {
           accountName: 'user2',
@@ -165,9 +167,7 @@ describe('Test bulk actions', function () {
     it('Should delete comments of an account on the instance', async function () {
       this.timeout(60000)
 
-      await bulkRemoveCommentsOf({
-        url: servers[0].url,
-        token: servers[0].accessToken,
+      await bulkCommand.removeCommentsOf({
         attributes: {
           accountName: 'user3@localhost:' + servers[1].port,
           scope: 'instance'