diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-16 09:47:51 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | 254d3579f5338f5fd775c17d15cdfc37078bcfb4 (patch) | |
tree | eaeb13fda16c16e98cd6991d202b0ca6a4cbdb63 /server/tests/external-plugins | |
parent | 89d241a79c262b9775c233b73cff080043ebb5e6 (diff) | |
download | PeerTube-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.ts | 6 | ||||
-rw-r--r-- | server/tests/external-plugins/auto-block-videos.ts | 13 | ||||
-rw-r--r-- | server/tests/external-plugins/auto-mute.ts | 11 |
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 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { HttpStatusCode } from '@shared/core-utils' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' | 6 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' |
7 | 7 | ||
8 | describe('Official plugin auth-ldap', function () { | 8 | describe('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' | |||
5 | import { | 5 | import { |
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' |
16 | import { Video } from '@shared/models' | 15 | import { Video } from '@shared/models' |
17 | 16 | ||
18 | async function check (server: ServerInfo, videoUUID: string, exists = true) { | 17 | async 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 | ||
27 | describe('Official plugin auto-block videos', function () { | 26 | describe('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' | |||
6 | import { | 6 | import { |
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 | ||
19 | describe('Official plugin auto-mute', function () { | 18 | describe('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 | { |