]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/server/follows-moderation.ts
Try to fix tests
[github/Chocobozzz/PeerTube.git] / server / tests / api / server / follows-moderation.ts
index 0bb3aa866d285855097ba5232c1bcc9232ffbc73..a82acdb34a4c8417e7e1e770337873f27259379a 100644 (file)
@@ -4,20 +4,20 @@ import * as chai from 'chai'
 import 'mocha'
 import {
   acceptFollower,
+  cleanupTests,
   flushAndRunMultipleServers,
-  killallServers,
   ServerInfo,
   setAccessTokensToServers,
   updateCustomSubConfig
-} from '../../../../shared/utils/index'
+} from '../../../../shared/extra-utils/index'
 import {
   follow,
   getFollowersListPaginationAndSort,
   getFollowingListPaginationAndSort,
-  removeFollower,
-  rejectFollower
-} from '../../../../shared/utils/server/follows'
-import { waitJobs } from '../../../../shared/utils/server/jobs'
+  rejectFollower,
+  removeFollower
+} from '../../../../shared/extra-utils/server/follows'
+import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
 import { ActorFollow } from '../../../../shared/models/actors'
 
 const expect = chai.expect
@@ -29,8 +29,8 @@ async function checkServer1And2HasFollowers (servers: ServerInfo[], state = 'acc
 
     const follow = res.body.data[0] as ActorFollow
     expect(follow.state).to.equal(state)
-    expect(follow.follower.url).to.equal('http://localhost:9001/accounts/peertube')
-    expect(follow.following.url).to.equal('http://localhost:9002/accounts/peertube')
+    expect(follow.follower.url).to.equal('http://localhost:' + servers[0].port + '/accounts/peertube')
+    expect(follow.following.url).to.equal('http://localhost:' + servers[1].port + '/accounts/peertube')
   }
 
   {
@@ -39,8 +39,8 @@ async function checkServer1And2HasFollowers (servers: ServerInfo[], state = 'acc
 
     const follow = res.body.data[0] as ActorFollow
     expect(follow.state).to.equal(state)
-    expect(follow.follower.url).to.equal('http://localhost:9001/accounts/peertube')
-    expect(follow.following.url).to.equal('http://localhost:9002/accounts/peertube')
+    expect(follow.follower.url).to.equal('http://localhost:' + servers[0].port + '/accounts/peertube')
+    expect(follow.following.url).to.equal('http://localhost:' + servers[1].port + '/accounts/peertube')
   }
 }
 
@@ -151,7 +151,7 @@ describe('Test follows moderation', function () {
   })
 
   it('Should accept a follower', async function () {
-    await acceptFollower(servers[1].url, servers[1].accessToken, 'peertube@localhost:9001')
+    await acceptFollower(servers[1].url, servers[1].accessToken, 'peertube@localhost:' + servers[0].port)
     await waitJobs(servers)
 
     await checkServer1And2HasFollowers(servers)
@@ -178,7 +178,7 @@ describe('Test follows moderation', function () {
       expect(res.body.total).to.equal(1)
     }
 
-    await rejectFollower(servers[2].url, servers[2].accessToken, 'peertube@localhost:9001')
+    await rejectFollower(servers[2].url, servers[2].accessToken, 'peertube@localhost:' + servers[0].port)
     await waitJobs(servers)
 
     await checkServer1And2HasFollowers(servers)
@@ -190,6 +190,6 @@ describe('Test follows moderation', function () {
   })
 
   after(async function () {
-    killallServers(servers)
+    await cleanupTests(servers)
   })
 })