X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fexternal-plugins%2Fauto-mute.ts;h=a9bf3c173a963a39500a19a3fb5bd34cea2e7c3e;hb=HEAD;hp=271779dd4c5eb99adfca4e269ccd0c7a6ad479e4;hpb=171efc48e67498406feb6d7873b3482b41505515;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/external-plugins/auto-mute.ts b/server/tests/external-plugins/auto-mute.ts index 271779dd4..a9bf3c173 100644 --- a/server/tests/external-plugins/auto-mute.ts +++ b/server/tests/external-plugins/auto-mute.ts @@ -1,19 +1,18 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' import { expect } from 'chai' +import { wait } from '@shared/core-utils' +import { HttpStatusCode } from '@shared/models' import { cleanupTests, createMultipleServers, doubleFollow, killallServers, makeGetRequest, - MockBlocklist, PeerTubeServer, - setAccessTokensToServers, - wait -} from '@shared/extra-utils' -import { HttpStatusCode } from '@shared/models' + setAccessTokensToServers +} from '@shared/server-commands' +import { MockBlocklist } from '../shared' describe('Official plugin auto-mute', function () { const autoMuteListPath = '/plugins/auto-mute/router/api/v1/mute-list' @@ -22,7 +21,7 @@ describe('Official plugin auto-mute', function () { let port: number before(async function () { - this.timeout(30000) + this.timeout(120000) servers = await createMultipleServers(2) await setAccessTokensToServers(servers) @@ -44,19 +43,17 @@ describe('Official plugin auto-mute', function () { await servers[0].plugins.updateSettings({ npmName: 'peertube-plugin-auto-mute', settings: { - 'blocklist-urls': `http://localhost:${port}/blocklist`, + 'blocklist-urls': `http://127.0.0.1:${port}/blocklist`, 'check-seconds-interval': 1 } }) }) it('Should add a server blocklist', async function () { - this.timeout(10000) - blocklistServer.replace({ data: [ { - value: 'localhost:' + servers[1].port + value: servers[1].host } ] }) @@ -68,12 +65,10 @@ describe('Official plugin auto-mute', function () { }) it('Should remove a server blocklist', async function () { - this.timeout(10000) - blocklistServer.replace({ data: [ { - value: 'localhost:' + servers[1].port, + value: servers[1].host, action: 'remove' } ] @@ -86,12 +81,10 @@ describe('Official plugin auto-mute', function () { }) it('Should add an account blocklist', async function () { - this.timeout(10000) - blocklistServer.replace({ data: [ { - value: 'root@localhost:' + servers[1].port + value: 'root@' + servers[1].host } ] }) @@ -103,12 +96,10 @@ describe('Official plugin auto-mute', function () { }) it('Should remove an account blocklist', async function () { - this.timeout(10000) - blocklistServer.replace({ data: [ { - value: 'root@localhost:' + servers[1].port, + value: 'root@' + servers[1].host, action: 'remove' } ] @@ -123,7 +114,7 @@ describe('Official plugin auto-mute', function () { it('Should auto mute an account, manually unmute it and do not remute it automatically', async function () { this.timeout(20000) - const account = 'root@localhost:' + servers[1].port + const account = 'root@' + servers[1].host blocklistServer.replace({ data: [ @@ -189,14 +180,14 @@ describe('Official plugin auto-mute', function () { await servers[1].plugins.updateSettings({ npmName: 'peertube-plugin-auto-mute', settings: { - 'blocklist-urls': 'http://localhost:' + servers[0].port + autoMuteListPath, + 'blocklist-urls': 'http://' + servers[0].host + autoMuteListPath, 'check-seconds-interval': 1, 'expose-mute-list': false } }) - await servers[0].blocklist.addToServerBlocklist({ account: 'root@localhost:' + servers[1].port }) - await servers[0].blocklist.addToMyBlocklist({ server: 'localhost:' + servers[1].port }) + await servers[0].blocklist.addToServerBlocklist({ account: 'root@' + servers[1].host }) + await servers[0].blocklist.addToMyBlocklist({ server: servers[1].host }) const res = await makeGetRequest({ url: servers[0].url, @@ -207,7 +198,7 @@ describe('Official plugin auto-mute', function () { const data = res.body.data expect(data).to.have.lengthOf(1) expect(data[0].updatedAt).to.exist - expect(data[0].value).to.equal('root@localhost:' + servers[1].port) + expect(data[0].value).to.equal('root@' + servers[1].host) await wait(2000)