aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/external-plugins
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 09:47:51 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit254d3579f5338f5fd775c17d15cdfc37078bcfb4 (patch)
treeeaeb13fda16c16e98cd6991d202b0ca6a4cbdb63 /server/tests/external-plugins
parent89d241a79c262b9775c233b73cff080043ebb5e6 (diff)
downloadPeerTube-254d3579f5338f5fd775c17d15cdfc37078bcfb4.tar.gz
PeerTube-254d3579f5338f5fd775c17d15cdfc37078bcfb4.tar.zst
PeerTube-254d3579f5338f5fd775c17d15cdfc37078bcfb4.zip
Use an object to represent a server
Diffstat (limited to 'server/tests/external-plugins')
-rw-r--r--server/tests/external-plugins/auth-ldap.ts6
-rw-r--r--server/tests/external-plugins/auto-block-videos.ts13
-rw-r--r--server/tests/external-plugins/auto-mute.ts11
3 files changed, 14 insertions, 16 deletions
diff --git a/server/tests/external-plugins/auth-ldap.ts b/server/tests/external-plugins/auth-ldap.ts
index ef624152e..aaaf23278 100644
--- a/server/tests/external-plugins/auth-ldap.ts
+++ b/server/tests/external-plugins/auth-ldap.ts
@@ -3,17 +3,17 @@
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' 6import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
7 7
8describe('Official plugin auth-ldap', function () { 8describe('Official plugin auth-ldap', function () {
9 let server: ServerInfo 9 let server: PeerTubeServer
10 let accessToken: string 10 let accessToken: string
11 let userId: number 11 let userId: number
12 12
13 before(async function () { 13 before(async function () {
14 this.timeout(30000) 14 this.timeout(30000)
15 15
16 server = await flushAndRunServer(1) 16 server = await createSingleServer(1)
17 await setAccessTokensToServers([ server ]) 17 await setAccessTokensToServers([ server ])
18 18
19 await server.plugins.install({ npmName: 'peertube-plugin-auth-ldap' }) 19 await server.plugins.install({ npmName: 'peertube-plugin-auth-ldap' })
diff --git a/server/tests/external-plugins/auto-block-videos.ts b/server/tests/external-plugins/auto-block-videos.ts
index 3b4b48bf0..9cb86310b 100644
--- a/server/tests/external-plugins/auto-block-videos.ts
+++ b/server/tests/external-plugins/auto-block-videos.ts
@@ -5,17 +5,16 @@ import { expect } from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow, 7 doubleFollow,
8 flushAndRunMultipleServers, 8 createMultipleServers,
9 killallServers, 9 killallServers,
10 MockBlocklist, 10 MockBlocklist,
11 reRunServer, 11 PeerTubeServer,
12 ServerInfo,
13 setAccessTokensToServers, 12 setAccessTokensToServers,
14 wait 13 wait
15} from '@shared/extra-utils' 14} from '@shared/extra-utils'
16import { Video } from '@shared/models' 15import { Video } from '@shared/models'
17 16
18async function check (server: ServerInfo, videoUUID: string, exists = true) { 17async function check (server: PeerTubeServer, videoUUID: string, exists = true) {
19 const { data } = await server.videos.list() 18 const { data } = await server.videos.list()
20 19
21 const video = data.find(v => v.uuid === videoUUID) 20 const video = data.find(v => v.uuid === videoUUID)
@@ -25,7 +24,7 @@ async function check (server: ServerInfo, videoUUID: string, exists = true) {
25} 24}
26 25
27describe('Official plugin auto-block videos', function () { 26describe('Official plugin auto-block videos', function () {
28 let servers: ServerInfo[] 27 let servers: PeerTubeServer[]
29 let blocklistServer: MockBlocklist 28 let blocklistServer: MockBlocklist
30 let server1Videos: Video[] = [] 29 let server1Videos: Video[] = []
31 let server2Videos: Video[] = [] 30 let server2Videos: Video[] = []
@@ -34,7 +33,7 @@ describe('Official plugin auto-block videos', function () {
34 before(async function () { 33 before(async function () {
35 this.timeout(60000) 34 this.timeout(60000)
36 35
37 servers = await flushAndRunMultipleServers(2) 36 servers = await createMultipleServers(2)
38 await setAccessTokensToServers(servers) 37 await setAccessTokensToServers(servers)
39 38
40 for (const server of servers) { 39 for (const server of servers) {
@@ -161,7 +160,7 @@ describe('Official plugin auto-block videos', function () {
161 await check(servers[0], video.uuid, true) 160 await check(servers[0], video.uuid, true)
162 161
163 await killallServers([ servers[0] ]) 162 await killallServers([ servers[0] ])
164 await reRunServer(servers[0]) 163 await servers[0].run()
165 await wait(2000) 164 await wait(2000)
166 165
167 await check(servers[0], video.uuid, true) 166 await check(servers[0], video.uuid, true)
diff --git a/server/tests/external-plugins/auto-mute.ts b/server/tests/external-plugins/auto-mute.ts
index 25b56a546..771201505 100644
--- a/server/tests/external-plugins/auto-mute.ts
+++ b/server/tests/external-plugins/auto-mute.ts
@@ -6,26 +6,25 @@ import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 doubleFollow, 8 doubleFollow,
9 flushAndRunMultipleServers, 9 createMultipleServers,
10 killallServers, 10 killallServers,
11 makeGetRequest, 11 makeGetRequest,
12 MockBlocklist, 12 MockBlocklist,
13 reRunServer, 13 PeerTubeServer,
14 ServerInfo,
15 setAccessTokensToServers, 14 setAccessTokensToServers,
16 wait 15 wait
17} from '@shared/extra-utils' 16} from '@shared/extra-utils'
18 17
19describe('Official plugin auto-mute', function () { 18describe('Official plugin auto-mute', function () {
20 const autoMuteListPath = '/plugins/auto-mute/router/api/v1/mute-list' 19 const autoMuteListPath = '/plugins/auto-mute/router/api/v1/mute-list'
21 let servers: ServerInfo[] 20 let servers: PeerTubeServer[]
22 let blocklistServer: MockBlocklist 21 let blocklistServer: MockBlocklist
23 let port: number 22 let port: number
24 23
25 before(async function () { 24 before(async function () {
26 this.timeout(30000) 25 this.timeout(30000)
27 26
28 servers = await flushAndRunMultipleServers(2) 27 servers = await createMultipleServers(2)
29 await setAccessTokensToServers(servers) 28 await setAccessTokensToServers(servers)
30 29
31 for (const server of servers) { 30 for (const server of servers) {
@@ -150,7 +149,7 @@ describe('Official plugin auto-mute', function () {
150 } 149 }
151 150
152 await killallServers([ servers[0] ]) 151 await killallServers([ servers[0] ])
153 await reRunServer(servers[0]) 152 await servers[0].run()
154 await wait(2000) 153 await wait(2000)
155 154
156 { 155 {