X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Factivitypub%2Ffetch.ts;h=d5e21404c39eeed956022697f6f17142ef8a33a5;hb=6c5065a011b099618681a37bd77eaa7bd3db752e;hp=03609c1a977cad092f04c9d02dbd43c2fb2b2ebb;hpb=73471b1a52f242e86364ffb077ea6cadb3b07ae2;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/activitypub/fetch.ts b/server/tests/api/activitypub/fetch.ts index 03609c1a9..d5e21404c 100644 --- a/server/tests/api/activitypub/fetch.ts +++ b/server/tests/api/activitypub/fetch.ts @@ -1,23 +1,19 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' - +import * as chai from 'chai' import { + cleanupTests, createUser, doubleFollow, flushAndRunMultipleServers, - flushTests, getVideosListSort, - killallServers, ServerInfo, setAccessTokensToServers, - setActorField, - setVideoField, uploadVideo, userLogin, waitJobs -} from '../../../../shared/utils' -import * as chai from 'chai' +} from '../../../../shared/extra-utils' import { Video } from '../../../../shared/models/videos' const expect = chai.expect @@ -37,7 +33,7 @@ describe('Test ActivityPub fetcher', function () { const user = { username: 'user1', password: 'password' } for (const server of servers) { - await createUser(server.url, server.accessToken, user.username, user.password) + await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) } const userAccessToken = await userLogin(servers[0], user) @@ -47,8 +43,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 servers[0].sqlCommand.setActorField(to, 'url', value) + } + + { + const value = 'http://localhost:' + servers[2].port + '/videos/watch/' + badVideoUUID + await servers[0].sqlCommand.setVideoField(badVideoUUID, 'url', value) + } }) it('Should add only the video with a valid actor URL', async function () { @@ -77,11 +81,8 @@ describe('Test ActivityPub fetcher', function () { }) after(async function () { - killallServers(servers) + this.timeout(20000) - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } + await cleanupTests(servers) }) })