]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/activitypub/fetch.ts
Merge branch 'master' into develop
[github/Chocobozzz/PeerTube.git] / server / tests / api / activitypub / fetch.ts
index 9cbc7dd848864fc3256d0c32e566f53ba98f28b6..35fd94eed6b66cd4181c47badc6fb2e8a03d3f18 100644 (file)
@@ -1,15 +1,14 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
 
 import {
+  cleanupTests,
   closeAllSequelize,
   createUser,
   doubleFollow,
   flushAndRunMultipleServers,
-  flushTests,
   getVideosListSort,
-  killallServers,
   ServerInfo,
   setAccessTokensToServers,
   setActorField,
@@ -17,7 +16,7 @@ import {
   uploadVideo,
   userLogin,
   waitJobs
-} from '../../../../shared/utils'
+} from '../../../../shared/extra-utils'
 import * as chai from 'chai'
 import { Video } from '../../../../shared/models/videos'
 
@@ -48,8 +47,16 @@ describe('Test ActivityPub fetcher', function () {
     const badVideoUUID = res.body.video.uuid
     await uploadVideo(servers[0].url, userAccessToken, { name: 'video user' })
 
-    await setActorField(1, 'http://localhost:9001/accounts/user1', 'url', 'http://localhost:9002/accounts/user1')
-    await setVideoField(1, badVideoUUID, 'url', 'http://localhost:9003/videos/watch/' + badVideoUUID)
+    {
+      const to = 'http://localhost:' + servers[0].port + '/accounts/user1'
+      const value = 'http://localhost:' + servers[1].port + '/accounts/user1'
+      await setActorField(servers[0].internalServerNumber, to, 'url', value)
+    }
+
+    {
+      const value = 'http://localhost:' + servers[2].port + '/videos/watch/' + badVideoUUID
+      await setVideoField(servers[0].internalServerNumber, badVideoUUID, 'url', value)
+    }
   })
 
   it('Should add only the video with a valid actor URL', async function () {
@@ -78,13 +85,10 @@ describe('Test ActivityPub fetcher', function () {
   })
 
   after(async function () {
-    killallServers(servers)
+    this.timeout(20000)
 
-    await closeAllSequelize(servers)
+    await cleanupTests(servers)
 
-    // Keep the logs if the test failed
-    if (this['ok']) {
-      await flushTests()
-    }
+    await closeAllSequelize(servers)
   })
 })