]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/moderation/blocklist.ts
Fix runner vod transcoding error test
[github/Chocobozzz/PeerTube.git] / server / tests / api / moderation / blocklist.ts
index ef2c5d7f36ee34a4f6d35fcfab5a7c7fe11e1e8a..b90d8c16c0df94b3664afabf61304aa502d196e1 100644 (file)
@@ -1,6 +1,6 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
-import * as chai from 'chai'
+import { expect } from 'chai'
 import { UserNotificationType } from '@shared/models'
 import {
   BlocklistCommand,
@@ -14,8 +14,6 @@ import {
   waitJobs
 } from '@shared/server-commands'
 
-const expect = chai.expect
-
 async function checkAllVideos (server: PeerTubeServer, token: string) {
   {
     const { data } = await server.videos.listWithToken({ token })
@@ -156,7 +154,7 @@ describe('Test blocklist', function () {
       })
 
       it('Should block a remote account', async function () {
-        await command.addToMyBlocklist({ account: 'user2@localhost:' + servers[1].port })
+        await command.addToMyBlocklist({ account: 'user2@' + servers[1].host })
       })
 
       it('Should hide its videos', async function () {
@@ -219,7 +217,7 @@ describe('Test blocklist', function () {
             server: servers[0],
             token: userToken1,
             videoUUID: videoUUID2,
-            text: 'hello @root@localhost:' + servers[0].port
+            text: 'hello @root@' + servers[0].host
           }
           await checkCommentNotification(servers[0], comment, 'absence')
         }
@@ -239,7 +237,7 @@ describe('Test blocklist', function () {
           expect(block.byAccount.name).to.equal('root')
           expect(block.blockedAccount.displayName).to.equal('user2')
           expect(block.blockedAccount.name).to.equal('user2')
-          expect(block.blockedAccount.host).to.equal('localhost:' + servers[1].port)
+          expect(block.blockedAccount.host).to.equal('' + servers[1].host)
         }
 
         {
@@ -251,7 +249,7 @@ describe('Test blocklist', function () {
           expect(block.byAccount.name).to.equal('root')
           expect(block.blockedAccount.displayName).to.equal('user1')
           expect(block.blockedAccount.name).to.equal('user1')
-          expect(block.blockedAccount.host).to.equal('localhost:' + servers[0].port)
+          expect(block.blockedAccount.host).to.equal('' + servers[0].host)
         }
       })
 
@@ -349,7 +347,7 @@ describe('Test blocklist', function () {
       })
 
       it('Should unblock the remote account', async function () {
-        await command.removeFromMyBlocklist({ account: 'user2@localhost:' + servers[1].port })
+        await command.removeFromMyBlocklist({ account: 'user2@' + servers[1].host })
       })
 
       it('Should display its videos', async function () {
@@ -403,7 +401,7 @@ describe('Test blocklist', function () {
             server: servers[0],
             token: userToken1,
             videoUUID: videoUUID2,
-            text: 'hello @root@localhost:' + servers[0].port
+            text: 'hello @root@' + servers[0].host
           }
           await checkCommentNotification(servers[0], comment, 'presence')
         }
@@ -421,7 +419,7 @@ describe('Test blocklist', function () {
       })
 
       it('Should block a remote server', async function () {
-        await command.addToMyBlocklist({ server: 'localhost:' + servers[1].port })
+        await command.addToMyBlocklist({ server: '' + servers[1].host })
       })
 
       it('Should hide its videos', async function () {
@@ -441,8 +439,6 @@ describe('Test blocklist', function () {
       })
 
       it('Should hide its comments', async function () {
-        this.timeout(10000)
-
         const { id } = await commentsCommand[1].createThread({ token: userToken2, videoId: videoUUID1, text: 'hidden comment 2' })
 
         await waitJobs(servers)
@@ -465,7 +461,7 @@ describe('Test blocklist', function () {
             server: servers[1],
             token: userToken2,
             videoUUID: videoUUID1,
-            text: 'hello @root@localhost:' + servers[0].port
+            text: 'hello @root@' + servers[0].host
           }
           await checkCommentNotification(servers[0], comment, 'absence')
         }
@@ -478,7 +474,7 @@ describe('Test blocklist', function () {
         const block = body.data[0]
         expect(block.byAccount.displayName).to.equal('root')
         expect(block.byAccount.name).to.equal('root')
-        expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port)
+        expect(block.blockedServer.host).to.equal('' + servers[1].host)
       })
 
       it('Should search blocked servers', async function () {
@@ -518,7 +514,7 @@ describe('Test blocklist', function () {
       })
 
       it('Should unblock the remote server', async function () {
-        await command.removeFromMyBlocklist({ server: 'localhost:' + servers[1].port })
+        await command.removeFromMyBlocklist({ server: '' + servers[1].host })
       })
 
       it('Should display its videos', function () {
@@ -542,7 +538,7 @@ describe('Test blocklist', function () {
             server: servers[1],
             token: userToken2,
             videoUUID: videoUUID1,
-            text: 'hello @root@localhost:' + servers[0].port
+            text: 'hello @root@' + servers[0].host
           }
           await checkCommentNotification(servers[0], comment, 'presence')
         }
@@ -566,7 +562,7 @@ describe('Test blocklist', function () {
       })
 
       it('Should block a remote account', async function () {
-        await command.addToServerBlocklist({ account: 'user2@localhost:' + servers[1].port })
+        await command.addToServerBlocklist({ account: 'user2@' + servers[1].host })
       })
 
       it('Should hide its videos', async function () {
@@ -626,7 +622,7 @@ describe('Test blocklist', function () {
             server: servers[1],
             token: userToken2,
             videoUUID: videoUUID1,
-            text: 'hello @root@localhost:' + servers[0].port
+            text: 'hello @root@' + servers[0].host
           }
           await checkCommentNotification(servers[0], comment, 'absence')
         }
@@ -642,7 +638,7 @@ describe('Test blocklist', function () {
           expect(block.byAccount.name).to.equal('peertube')
           expect(block.blockedAccount.displayName).to.equal('user2')
           expect(block.blockedAccount.name).to.equal('user2')
-          expect(block.blockedAccount.host).to.equal('localhost:' + servers[1].port)
+          expect(block.blockedAccount.host).to.equal('' + servers[1].host)
         }
 
         {
@@ -654,7 +650,7 @@ describe('Test blocklist', function () {
           expect(block.byAccount.name).to.equal('peertube')
           expect(block.blockedAccount.displayName).to.equal('user1')
           expect(block.blockedAccount.name).to.equal('user1')
-          expect(block.blockedAccount.host).to.equal('localhost:' + servers[0].port)
+          expect(block.blockedAccount.host).to.equal('' + servers[0].host)
         }
       })
 
@@ -687,7 +683,7 @@ describe('Test blocklist', function () {
       })
 
       it('Should unblock the remote account', async function () {
-        await command.removeFromServerBlocklist({ account: 'user2@localhost:' + servers[1].port })
+        await command.removeFromServerBlocklist({ account: 'user2@' + servers[1].host })
       })
 
       it('Should display its videos', async function () {
@@ -723,7 +719,7 @@ describe('Test blocklist', function () {
             server: servers[1],
             token: userToken2,
             videoUUID: videoUUID1,
-            text: 'hello @root@localhost:' + servers[0].port
+            text: 'hello @root@' + servers[0].host
           }
           await checkCommentNotification(servers[0], comment, 'presence')
         }
@@ -745,7 +741,7 @@ describe('Test blocklist', function () {
       })
 
       it('Should block a remote server', async function () {
-        await command.addToServerBlocklist({ server: 'localhost:' + servers[1].port })
+        await command.addToServerBlocklist({ server: '' + servers[1].host })
       })
 
       it('Should hide its videos', async function () {
@@ -769,8 +765,6 @@ describe('Test blocklist', function () {
       })
 
       it('Should hide its comments', async function () {
-        this.timeout(10000)
-
         const { id } = await commentsCommand[1].createThread({ token: userToken2, videoId: videoUUID1, text: 'hidden comment 2' })
 
         await waitJobs(servers)
@@ -793,7 +787,7 @@ describe('Test blocklist', function () {
             server: servers[1],
             token: userToken2,
             videoUUID: videoUUID1,
-            text: 'hello @root@localhost:' + servers[0].port
+            text: 'hello @root@' + servers[0].host
           }
           await checkCommentNotification(servers[0], comment, 'absence')
         }
@@ -822,7 +816,7 @@ describe('Test blocklist', function () {
         const block = body.data[0]
         expect(block.byAccount.displayName).to.equal('peertube')
         expect(block.byAccount.name).to.equal('peertube')
-        expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port)
+        expect(block.blockedServer.host).to.equal('' + servers[1].host)
       })
 
       it('Should search blocked servers', async function () {
@@ -850,7 +844,7 @@ describe('Test blocklist', function () {
       })
 
       it('Should unblock the remote server', async function () {
-        await command.removeFromServerBlocklist({ server: 'localhost:' + servers[1].port })
+        await command.removeFromServerBlocklist({ server: '' + servers[1].host })
       })
 
       it('Should list all videos', async function () {
@@ -878,7 +872,7 @@ describe('Test blocklist', function () {
             server: servers[1],
             token: userToken2,
             videoUUID: videoUUID1,
-            text: 'hello @root@localhost:' + servers[0].port
+            text: 'hello @root@' + servers[0].host
           }
           await checkCommentNotification(servers[0], comment, 'presence')
         }