]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/moderation/video-blacklist.ts
Adapt CLI to new commands
[github/Chocobozzz/PeerTube.git] / server / tests / api / moderation / video-blacklist.ts
index 17a68e4a6d4f2feffeed6b3759d263f976ddf38d..b61effc5751166e4785ae9aea05ad922089c3589 100644 (file)
@@ -12,16 +12,15 @@ import {
   getMyUserInformation,
   getMyVideos,
   getVideosList,
+  ImportsCommand,
   killallServers,
   reRunServer,
   ServerInfo,
   setAccessTokensToServers,
   updateVideo,
   uploadVideo,
-  userLogin,
   waitJobs
 } from '@shared/extra-utils'
-import { getGoodVideoUrl, getMagnetURI, importVideo } from '@shared/extra-utils/videos/video-imports'
 import { User, UserAdminFlag, UserRole, VideoBlacklist, VideoBlacklistType } from '@shared/models'
 
 const expect = chai.expect
@@ -342,7 +341,7 @@ describe('Test video blacklist', function () {
     before(async function () {
       this.timeout(20000)
 
-      killallServers([ servers[0] ])
+      await killallServers([ servers[0] ])
 
       const config = {
         auto_blacklist: {
@@ -366,7 +365,7 @@ describe('Test video blacklist', function () {
           role: UserRole.USER
         })
 
-        userWithoutFlag = await userLogin(servers[0], user)
+        userWithoutFlag = await servers[0].loginCommand.getAccessToken(user)
 
         const res = await getMyUserInformation(servers[0].url, userWithoutFlag)
         const body: User = res.body
@@ -384,7 +383,7 @@ describe('Test video blacklist', function () {
           role: UserRole.USER
         })
 
-        userWithFlag = await userLogin(servers[0], user)
+        userWithFlag = await servers[0].loginCommand.getAccessToken(user)
       }
 
       await waitJobs(servers)
@@ -402,11 +401,11 @@ describe('Test video blacklist', function () {
       this.timeout(15000)
 
       const attributes = {
-        targetUrl: getGoodVideoUrl(),
+        targetUrl: ImportsCommand.getGoodVideoUrl(),
         name: 'URL import',
         channelId: channelOfUserWithoutFlag
       }
-      await importVideo(servers[0].url, userWithoutFlag, attributes)
+      await servers[0].importsCommand.importVideo({ token: userWithoutFlag, attributes })
 
       const body = await command.list({ sort: 'createdAt', type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED })
       expect(body.total).to.equal(2)
@@ -415,11 +414,11 @@ describe('Test video blacklist', function () {
 
     it('Should auto blacklist a video on torrent import', async function () {
       const attributes = {
-        magnetUri: getMagnetURI(),
+        magnetUri: ImportsCommand.getMagnetURI(),
         name: 'Torrent import',
         channelId: channelOfUserWithoutFlag
       }
-      await importVideo(servers[0].url, userWithoutFlag, attributes)
+      await servers[0].importsCommand.importVideo({ token: userWithoutFlag, attributes })
 
       const body = await command.list({ sort: 'createdAt', type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED })
       expect(body.total).to.equal(3)