aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/external-plugins/auto-mute.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-07 10:33:49 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:17 +0200
commitae2abfd3aed3e75d39a316b49b914d187faa7475 (patch)
tree4d5060dc310f3d8cdcd5829779522f49b3d10e71 /server/tests/external-plugins/auto-mute.ts
parent9c6327f803aaf4200672f1fc40b2f43786daca47 (diff)
downloadPeerTube-ae2abfd3aed3e75d39a316b49b914d187faa7475.tar.gz
PeerTube-ae2abfd3aed3e75d39a316b49b914d187faa7475.tar.zst
PeerTube-ae2abfd3aed3e75d39a316b49b914d187faa7475.zip
Introduce plugins command
Diffstat (limited to 'server/tests/external-plugins/auto-mute.ts')
-rw-r--r--server/tests/external-plugins/auto-mute.ts40
1 files changed, 12 insertions, 28 deletions
diff --git a/server/tests/external-plugins/auto-mute.ts b/server/tests/external-plugins/auto-mute.ts
index 09355d932..8fcf94452 100644
--- a/server/tests/external-plugins/auto-mute.ts
+++ b/server/tests/external-plugins/auto-mute.ts
@@ -2,30 +2,24 @@
2 2
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { HttpStatusCode } from '@shared/core-utils'
5import { 6import {
6 addAccountToServerBlocklist, 7 addAccountToServerBlocklist,
7 addServerToAccountBlocklist, 8 addServerToAccountBlocklist,
8 removeAccountFromServerBlocklist 9 cleanupTests,
9} from '@shared/extra-utils/users/blocklist'
10import {
11 doubleFollow, 10 doubleFollow,
11 flushAndRunMultipleServers,
12 getVideosList, 12 getVideosList,
13 installPlugin, 13 killallServers,
14 makeGetRequest, 14 makeGetRequest,
15 MockBlocklist, 15 MockBlocklist,
16 removeAccountFromServerBlocklist,
17 reRunServer,
18 ServerInfo,
16 setAccessTokensToServers, 19 setAccessTokensToServers,
17 updatePluginSettings,
18 uploadVideoAndGetId, 20 uploadVideoAndGetId,
19 wait 21 wait
20} from '../../../shared/extra-utils' 22} from '@shared/extra-utils'
21import {
22 cleanupTests,
23 flushAndRunMultipleServers,
24 killallServers,
25 reRunServer,
26 ServerInfo
27} from '../../../shared/extra-utils/server/servers'
28import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
29 23
30describe('Official plugin auto-mute', function () { 24describe('Official plugin auto-mute', function () {
31 const autoMuteListPath = '/plugins/auto-mute/router/api/v1/mute-list' 25 const autoMuteListPath = '/plugins/auto-mute/router/api/v1/mute-list'
@@ -40,11 +34,7 @@ describe('Official plugin auto-mute', function () {
40 await setAccessTokensToServers(servers) 34 await setAccessTokensToServers(servers)
41 35
42 for (const server of servers) { 36 for (const server of servers) {
43 await installPlugin({ 37 await server.pluginsCommand.install({ npmName: 'peertube-plugin-auto-mute' })
44 url: server.url,
45 accessToken: server.accessToken,
46 npmName: 'peertube-plugin-auto-mute'
47 })
48 } 38 }
49 39
50 blocklistServer = new MockBlocklist() 40 blocklistServer = new MockBlocklist()
@@ -57,9 +47,7 @@ describe('Official plugin auto-mute', function () {
57 }) 47 })
58 48
59 it('Should update plugin settings', async function () { 49 it('Should update plugin settings', async function () {
60 await updatePluginSettings({ 50 await servers[0].pluginsCommand.updateSettings({
61 url: servers[0].url,
62 accessToken: servers[0].accessToken,
63 npmName: 'peertube-plugin-auto-mute', 51 npmName: 'peertube-plugin-auto-mute',
64 settings: { 52 settings: {
65 'blocklist-urls': `http://localhost:${port}/blocklist`, 53 'blocklist-urls': `http://localhost:${port}/blocklist`,
@@ -185,9 +173,7 @@ describe('Official plugin auto-mute', function () {
185 }) 173 })
186 174
187 it('Should enable auto mute list', async function () { 175 it('Should enable auto mute list', async function () {
188 await updatePluginSettings({ 176 await servers[0].pluginsCommand.updateSettings({
189 url: servers[0].url,
190 accessToken: servers[0].accessToken,
191 npmName: 'peertube-plugin-auto-mute', 177 npmName: 'peertube-plugin-auto-mute',
192 settings: { 178 settings: {
193 'blocklist-urls': '', 179 'blocklist-urls': '',
@@ -206,9 +192,7 @@ describe('Official plugin auto-mute', function () {
206 it('Should mute an account on server 1, and server 2 auto mutes it', async function () { 192 it('Should mute an account on server 1, and server 2 auto mutes it', async function () {
207 this.timeout(20000) 193 this.timeout(20000)
208 194
209 await updatePluginSettings({ 195 await servers[1].pluginsCommand.updateSettings({
210 url: servers[1].url,
211 accessToken: servers[1].accessToken,
212 npmName: 'peertube-plugin-auto-mute', 196 npmName: 'peertube-plugin-auto-mute',
213 settings: { 197 settings: {
214 'blocklist-urls': 'http://localhost:' + servers[0].port + autoMuteListPath, 198 'blocklist-urls': 'http://localhost:' + servers[0].port + autoMuteListPath,