aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
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/api/videos
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/api/videos')
-rw-r--r--server/tests/api/videos/audio-only.ts6
-rw-r--r--server/tests/api/videos/multiple-servers.ts8
-rw-r--r--server/tests/api/videos/resumable-upload.ts8
-rw-r--r--server/tests/api/videos/single-server.ts8
-rw-r--r--server/tests/api/videos/video-captions.ts8
-rw-r--r--server/tests/api/videos/video-change-ownership.ts14
-rw-r--r--server/tests/api/videos/video-channels.ts10
-rw-r--r--server/tests/api/videos/video-comments.ts8
-rw-r--r--server/tests/api/videos/video-description.ts6
-rw-r--r--server/tests/api/videos/video-hls.ts10
-rw-r--r--server/tests/api/videos/video-imports.ts12
-rw-r--r--server/tests/api/videos/video-nsfw.ts6
-rw-r--r--server/tests/api/videos/video-playlist-thumbnails.ts12
-rw-r--r--server/tests/api/videos/video-playlists.ts18
-rw-r--r--server/tests/api/videos/video-privacy.ts8
-rw-r--r--server/tests/api/videos/video-schedule-update.ts8
-rw-r--r--server/tests/api/videos/video-transcoder.ts10
-rw-r--r--server/tests/api/videos/videos-filter.ts10
-rw-r--r--server/tests/api/videos/videos-history.ts13
-rw-r--r--server/tests/api/videos/videos-overview.ts6
-rw-r--r--server/tests/api/videos/videos-views-cleaner.ts13
21 files changed, 100 insertions, 102 deletions
diff --git a/server/tests/api/videos/audio-only.ts b/server/tests/api/videos/audio-only.ts
index b2952e38b..b9bf96650 100644
--- a/server/tests/api/videos/audio-only.ts
+++ b/server/tests/api/videos/audio-only.ts
@@ -4,12 +4,12 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { join } from 'path' 5import { join } from 'path'
6import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils' 6import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils'
7import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 7import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
8 8
9const expect = chai.expect 9const expect = chai.expect
10 10
11describe('Test audio only video transcoding', function () { 11describe('Test audio only video transcoding', function () {
12 let servers: ServerInfo[] = [] 12 let servers: PeerTubeServer[] = []
13 let videoUUID: string 13 let videoUUID: string
14 14
15 before(async function () { 15 before(async function () {
@@ -36,7 +36,7 @@ describe('Test audio only video transcoding', function () {
36 } 36 }
37 } 37 }
38 } 38 }
39 servers = await flushAndRunMultipleServers(2, configOverride) 39 servers = await createMultipleServers(2, configOverride)
40 40
41 // Get the access tokens 41 // Get the access tokens
42 await setAccessTokensToServers(servers) 42 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index 89d842307..562079a15 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -12,8 +12,8 @@ import {
12 completeVideoCheck, 12 completeVideoCheck,
13 dateIsValid, 13 dateIsValid,
14 doubleFollow, 14 doubleFollow,
15 flushAndRunMultipleServers, 15 createMultipleServers,
16 ServerInfo, 16 PeerTubeServer,
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 testImage, 18 testImage,
19 wait, 19 wait,
@@ -25,7 +25,7 @@ import { VideoCommentThreadTree, VideoPrivacy } from '@shared/models'
25const expect = chai.expect 25const expect = chai.expect
26 26
27describe('Test multiple servers', function () { 27describe('Test multiple servers', function () {
28 let servers: ServerInfo[] = [] 28 let servers: PeerTubeServer[] = []
29 const toRemove = [] 29 const toRemove = []
30 let videoUUID = '' 30 let videoUUID = ''
31 let videoChannelId: number 31 let videoChannelId: number
@@ -33,7 +33,7 @@ describe('Test multiple servers', function () {
33 before(async function () { 33 before(async function () {
34 this.timeout(120000) 34 this.timeout(120000)
35 35
36 servers = await flushAndRunMultipleServers(3) 36 servers = await createMultipleServers(3)
37 37
38 // Get the access tokens 38 // Get the access tokens
39 await setAccessTokensToServers(servers) 39 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/videos/resumable-upload.ts b/server/tests/api/videos/resumable-upload.ts
index 2f1cf8a55..b4fc5ee09 100644
--- a/server/tests/api/videos/resumable-upload.ts
+++ b/server/tests/api/videos/resumable-upload.ts
@@ -8,8 +8,8 @@ import { HttpStatusCode } from '@shared/core-utils'
8import { 8import {
9 buildAbsoluteFixturePath, 9 buildAbsoluteFixturePath,
10 cleanupTests, 10 cleanupTests,
11 flushAndRunServer, 11 createSingleServer,
12 ServerInfo, 12 PeerTubeServer,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 setDefaultVideoChannel 14 setDefaultVideoChannel
15} from '@shared/extra-utils' 15} from '@shared/extra-utils'
@@ -21,7 +21,7 @@ const expect = chai.expect
21 21
22describe('Test resumable upload', function () { 22describe('Test resumable upload', function () {
23 const defaultFixture = 'video_short.mp4' 23 const defaultFixture = 'video_short.mp4'
24 let server: ServerInfo 24 let server: PeerTubeServer
25 let rootId: number 25 let rootId: number
26 26
27 async function buildSize (fixture: string, size?: number) { 27 async function buildSize (fixture: string, size?: number) {
@@ -99,7 +99,7 @@ describe('Test resumable upload', function () {
99 before(async function () { 99 before(async function () {
100 this.timeout(30000) 100 this.timeout(30000)
101 101
102 server = await flushAndRunServer(1) 102 server = await createSingleServer(1)
103 await setAccessTokensToServers([ server ]) 103 await setAccessTokensToServers([ server ])
104 await setDefaultVideoChannel([ server ]) 104 await setDefaultVideoChannel([ server ])
105 105
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts
index 12c1f7b2f..c0535be09 100644
--- a/server/tests/api/videos/single-server.ts
+++ b/server/tests/api/videos/single-server.ts
@@ -6,8 +6,8 @@ import {
6 checkVideoFilesWereRemoved, 6 checkVideoFilesWereRemoved,
7 cleanupTests, 7 cleanupTests,
8 completeVideoCheck, 8 completeVideoCheck,
9 flushAndRunServer, 9 createSingleServer,
10 ServerInfo, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 testImage, 12 testImage,
13 wait 13 wait
@@ -19,7 +19,7 @@ const expect = chai.expect
19describe('Test a single server', function () { 19describe('Test a single server', function () {
20 20
21 function runSuite (mode: 'legacy' | 'resumable') { 21 function runSuite (mode: 'legacy' | 'resumable') {
22 let server: ServerInfo = null 22 let server: PeerTubeServer = null
23 let videoId: number | string 23 let videoId: number | string
24 let videoId2: string 24 let videoId2: string
25 let videoUUID = '' 25 let videoUUID = ''
@@ -94,7 +94,7 @@ describe('Test a single server', function () {
94 before(async function () { 94 before(async function () {
95 this.timeout(30000) 95 this.timeout(30000)
96 96
97 server = await flushAndRunServer(1) 97 server = await createSingleServer(1)
98 98
99 await setAccessTokensToServers([ server ]) 99 await setAccessTokensToServers([ server ])
100 }) 100 })
diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts
index abc07194d..6caba6aa6 100644
--- a/server/tests/api/videos/video-captions.ts
+++ b/server/tests/api/videos/video-captions.ts
@@ -6,8 +6,8 @@ import {
6 checkVideoFilesWereRemoved, 6 checkVideoFilesWereRemoved,
7 cleanupTests, 7 cleanupTests,
8 doubleFollow, 8 doubleFollow,
9 flushAndRunMultipleServers, 9 createMultipleServers,
10 ServerInfo, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 testCaptionFile, 12 testCaptionFile,
13 wait, 13 wait,
@@ -19,13 +19,13 @@ const expect = chai.expect
19describe('Test video captions', function () { 19describe('Test video captions', function () {
20 const uuidRegex = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' 20 const uuidRegex = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
21 21
22 let servers: ServerInfo[] 22 let servers: PeerTubeServer[]
23 let videoUUID: string 23 let videoUUID: string
24 24
25 before(async function () { 25 before(async function () {
26 this.timeout(60000) 26 this.timeout(60000)
27 27
28 servers = await flushAndRunMultipleServers(2) 28 servers = await createMultipleServers(2)
29 29
30 await setAccessTokensToServers(servers) 30 await setAccessTokensToServers(servers)
31 await doubleFollow(servers[0], servers[1]) 31 await doubleFollow(servers[0], servers[1])
diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.ts
index 352eb5ea3..cefddb68e 100644
--- a/server/tests/api/videos/video-change-ownership.ts
+++ b/server/tests/api/videos/video-change-ownership.ts
@@ -7,9 +7,9 @@ import {
7 ChangeOwnershipCommand, 7 ChangeOwnershipCommand,
8 cleanupTests, 8 cleanupTests,
9 doubleFollow, 9 doubleFollow,
10 flushAndRunMultipleServers, 10 createMultipleServers,
11 flushAndRunServer, 11 createSingleServer,
12 ServerInfo, 12 PeerTubeServer,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 setDefaultVideoChannel, 14 setDefaultVideoChannel,
15 waitJobs 15 waitJobs
@@ -19,7 +19,7 @@ import { VideoPrivacy } from '@shared/models'
19const expect = chai.expect 19const expect = chai.expect
20 20
21describe('Test video change ownership - nominal', function () { 21describe('Test video change ownership - nominal', function () {
22 let servers: ServerInfo[] = [] 22 let servers: PeerTubeServer[] = []
23 23
24 const firstUser = 'first' 24 const firstUser = 'first'
25 const secondUser = 'second' 25 const secondUser = 'second'
@@ -39,7 +39,7 @@ describe('Test video change ownership - nominal', function () {
39 before(async function () { 39 before(async function () {
40 this.timeout(50000) 40 this.timeout(50000)
41 41
42 servers = await flushAndRunMultipleServers(2) 42 servers = await createMultipleServers(2)
43 await setAccessTokensToServers(servers) 43 await setAccessTokensToServers(servers)
44 await setDefaultVideoChannel(servers) 44 await setDefaultVideoChannel(servers)
45 45
@@ -251,7 +251,7 @@ describe('Test video change ownership - nominal', function () {
251}) 251})
252 252
253describe('Test video change ownership - quota too small', function () { 253describe('Test video change ownership - quota too small', function () {
254 let server: ServerInfo 254 let server: PeerTubeServer
255 const firstUser = 'first' 255 const firstUser = 'first'
256 const secondUser = 'second' 256 const secondUser = 'second'
257 257
@@ -263,7 +263,7 @@ describe('Test video change ownership - quota too small', function () {
263 this.timeout(50000) 263 this.timeout(50000)
264 264
265 // Run one server 265 // Run one server
266 server = await flushAndRunServer(1) 266 server = await createSingleServer(1)
267 await setAccessTokensToServers([ server ]) 267 await setAccessTokensToServers([ server ])
268 268
269 await server.users.create({ username: secondUser, videoQuota: 10 }) 269 await server.users.create({ username: secondUser, videoQuota: 10 })
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index 1efef932c..140fee7fe 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -7,8 +7,8 @@ import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants'
7import { 7import {
8 cleanupTests, 8 cleanupTests,
9 doubleFollow, 9 doubleFollow,
10 flushAndRunMultipleServers, 10 createMultipleServers,
11 ServerInfo, 11 PeerTubeServer,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 setDefaultVideoChannel, 13 setDefaultVideoChannel,
14 testFileExistsOrNot, 14 testFileExistsOrNot,
@@ -20,14 +20,14 @@ import { User, VideoChannel } from '@shared/models'
20 20
21const expect = chai.expect 21const expect = chai.expect
22 22
23async function findChannel (server: ServerInfo, channelId: number) { 23async function findChannel (server: PeerTubeServer, channelId: number) {
24 const body = await server.channels.list({ sort: '-name' }) 24 const body = await server.channels.list({ sort: '-name' })
25 25
26 return body.data.find(c => c.id === channelId) 26 return body.data.find(c => c.id === channelId)
27} 27}
28 28
29describe('Test video channels', function () { 29describe('Test video channels', function () {
30 let servers: ServerInfo[] 30 let servers: PeerTubeServer[]
31 let userInfo: User 31 let userInfo: User
32 let secondVideoChannelId: number 32 let secondVideoChannelId: number
33 let totoChannel: number 33 let totoChannel: number
@@ -40,7 +40,7 @@ describe('Test video channels', function () {
40 before(async function () { 40 before(async function () {
41 this.timeout(60000) 41 this.timeout(60000)
42 42
43 servers = await flushAndRunMultipleServers(2) 43 servers = await createMultipleServers(2)
44 44
45 await setAccessTokensToServers(servers) 45 await setAccessTokensToServers(servers)
46 await setDefaultVideoChannel(servers) 46 await setDefaultVideoChannel(servers)
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts
index adb59bd74..9709e0628 100644
--- a/server/tests/api/videos/video-comments.ts
+++ b/server/tests/api/videos/video-comments.ts
@@ -6,8 +6,8 @@ import {
6 cleanupTests, 6 cleanupTests,
7 CommentsCommand, 7 CommentsCommand,
8 dateIsValid, 8 dateIsValid,
9 flushAndRunServer, 9 createSingleServer,
10 ServerInfo, 10 PeerTubeServer,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 testImage 12 testImage
13} from '@shared/extra-utils' 13} from '@shared/extra-utils'
@@ -15,7 +15,7 @@ import {
15const expect = chai.expect 15const expect = chai.expect
16 16
17describe('Test video comments', function () { 17describe('Test video comments', function () {
18 let server: ServerInfo 18 let server: PeerTubeServer
19 let videoId: number 19 let videoId: number
20 let videoUUID: string 20 let videoUUID: string
21 let threadId: number 21 let threadId: number
@@ -28,7 +28,7 @@ describe('Test video comments', function () {
28 before(async function () { 28 before(async function () {
29 this.timeout(30000) 29 this.timeout(30000)
30 30
31 server = await flushAndRunServer(1) 31 server = await createSingleServer(1)
32 32
33 await setAccessTokensToServers([ server ]) 33 await setAccessTokensToServers([ server ])
34 34
diff --git a/server/tests/api/videos/video-description.ts b/server/tests/api/videos/video-description.ts
index b89247288..ce45eac80 100644
--- a/server/tests/api/videos/video-description.ts
+++ b/server/tests/api/videos/video-description.ts
@@ -2,12 +2,12 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 5import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
6 6
7const expect = chai.expect 7const expect = chai.expect
8 8
9describe('Test video description', function () { 9describe('Test video description', function () {
10 let servers: ServerInfo[] = [] 10 let servers: PeerTubeServer[] = []
11 let videoUUID = '' 11 let videoUUID = ''
12 let videoId: number 12 let videoId: number
13 const longDescription = 'my super description for server 1'.repeat(50) 13 const longDescription = 'my super description for server 1'.repeat(50)
@@ -16,7 +16,7 @@ describe('Test video description', function () {
16 this.timeout(40000) 16 this.timeout(40000)
17 17
18 // Run servers 18 // Run servers
19 servers = await flushAndRunMultipleServers(2) 19 servers = await createMultipleServers(2)
20 20
21 // Get the access tokens 21 // Get the access tokens
22 await setAccessTokensToServers(servers) 22 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.ts
index 9d79f2683..4c4b18887 100644
--- a/server/tests/api/videos/video-hls.ts
+++ b/server/tests/api/videos/video-hls.ts
@@ -11,9 +11,9 @@ import {
11 checkTmpIsEmpty, 11 checkTmpIsEmpty,
12 cleanupTests, 12 cleanupTests,
13 doubleFollow, 13 doubleFollow,
14 flushAndRunMultipleServers, 14 createMultipleServers,
15 makeRawRequest, 15 makeRawRequest,
16 ServerInfo, 16 PeerTubeServer,
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 waitJobs, 18 waitJobs,
19 webtorrentAdd 19 webtorrentAdd
@@ -23,7 +23,7 @@ import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants'
23 23
24const expect = chai.expect 24const expect = chai.expect
25 25
26async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOnly: boolean, resolutions = [ 240, 360, 480, 720 ]) { 26async function checkHlsPlaylist (servers: PeerTubeServer[], videoUUID: string, hlsOnly: boolean, resolutions = [ 240, 360, 480, 720 ]) {
27 for (const server of servers) { 27 for (const server of servers) {
28 const videoDetails = await server.videos.get({ id: videoUUID }) 28 const videoDetails = await server.videos.get({ id: videoUUID })
29 const baseUrl = `http://${videoDetails.account.host}` 29 const baseUrl = `http://${videoDetails.account.host}`
@@ -98,7 +98,7 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string, hlsOn
98} 98}
99 99
100describe('Test HLS videos', function () { 100describe('Test HLS videos', function () {
101 let servers: ServerInfo[] = [] 101 let servers: PeerTubeServer[] = []
102 let videoUUID = '' 102 let videoUUID = ''
103 let videoAudioUUID = '' 103 let videoAudioUUID = ''
104 104
@@ -176,7 +176,7 @@ describe('Test HLS videos', function () {
176 } 176 }
177 } 177 }
178 } 178 }
179 servers = await flushAndRunMultipleServers(2, configOverride) 179 servers = await createMultipleServers(2, configOverride)
180 180
181 // Get the access tokens 181 // Get the access tokens
182 await setAccessTokensToServers(servers) 182 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts
index 8b6542aa4..4ef55c3af 100644
--- a/server/tests/api/videos/video-imports.ts
+++ b/server/tests/api/videos/video-imports.ts
@@ -6,9 +6,9 @@ import {
6 areHttpImportTestsDisabled, 6 areHttpImportTestsDisabled,
7 cleanupTests, 7 cleanupTests,
8 doubleFollow, 8 doubleFollow,
9 flushAndRunMultipleServers, 9 createMultipleServers,
10 ImportsCommand, 10 ImportsCommand,
11 ServerInfo, 11 PeerTubeServer,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 testCaptionFile, 13 testCaptionFile,
14 testImage, 14 testImage,
@@ -19,13 +19,13 @@ import { VideoPrivacy, VideoResolution } from '@shared/models'
19const expect = chai.expect 19const expect = chai.expect
20 20
21describe('Test video imports', function () { 21describe('Test video imports', function () {
22 let servers: ServerInfo[] = [] 22 let servers: PeerTubeServer[] = []
23 let channelIdServer1: number 23 let channelIdServer1: number
24 let channelIdServer2: number 24 let channelIdServer2: number
25 25
26 if (areHttpImportTestsDisabled()) return 26 if (areHttpImportTestsDisabled()) return
27 27
28 async function checkVideosServer1 (server: ServerInfo, idHttp: string, idMagnet: string, idTorrent: string) { 28 async function checkVideosServer1 (server: PeerTubeServer, idHttp: string, idMagnet: string, idTorrent: string) {
29 const videoHttp = await server.videos.get({ id: idHttp }) 29 const videoHttp = await server.videos.get({ id: idHttp })
30 30
31 expect(videoHttp.name).to.equal('small video - youtube') 31 expect(videoHttp.name).to.equal('small video - youtube')
@@ -63,7 +63,7 @@ describe('Test video imports', function () {
63 expect(bodyCaptions.total).to.equal(2) 63 expect(bodyCaptions.total).to.equal(2)
64 } 64 }
65 65
66 async function checkVideoServer2 (server: ServerInfo, id: number | string) { 66 async function checkVideoServer2 (server: PeerTubeServer, id: number | string) {
67 const video = await server.videos.get({ id }) 67 const video = await server.videos.get({ id })
68 68
69 expect(video.name).to.equal('my super name') 69 expect(video.name).to.equal('my super name')
@@ -84,7 +84,7 @@ describe('Test video imports', function () {
84 this.timeout(30_000) 84 this.timeout(30_000)
85 85
86 // Run servers 86 // Run servers
87 servers = await flushAndRunMultipleServers(2) 87 servers = await createMultipleServers(2)
88 88
89 await setAccessTokensToServers(servers) 89 await setAccessTokensToServers(servers)
90 90
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts
index 95395a582..b25dcda20 100644
--- a/server/tests/api/videos/video-nsfw.ts
+++ b/server/tests/api/videos/video-nsfw.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' 5import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
6import { BooleanBothQuery, CustomConfig, ResultList, Video, VideosOverview } from '@shared/models' 6import { BooleanBothQuery, CustomConfig, ResultList, Video, VideosOverview } from '@shared/models'
7 7
8const expect = chai.expect 8const expect = chai.expect
@@ -13,7 +13,7 @@ function createOverviewRes (overview: VideosOverview) {
13} 13}
14 14
15describe('Test video NSFW policy', function () { 15describe('Test video NSFW policy', function () {
16 let server: ServerInfo 16 let server: PeerTubeServer
17 let userAccessToken: string 17 let userAccessToken: string
18 let customConfig: CustomConfig 18 let customConfig: CustomConfig
19 19
@@ -61,7 +61,7 @@ describe('Test video NSFW policy', function () {
61 61
62 before(async function () { 62 before(async function () {
63 this.timeout(50000) 63 this.timeout(50000)
64 server = await flushAndRunServer(1) 64 server = await createSingleServer(1)
65 65
66 // Get the access tokens 66 // Get the access tokens
67 await setAccessTokensToServers([ server ]) 67 await setAccessTokensToServers([ server ])
diff --git a/server/tests/api/videos/video-playlist-thumbnails.ts b/server/tests/api/videos/video-playlist-thumbnails.ts
index 709f64c4d..9a682c12b 100644
--- a/server/tests/api/videos/video-playlist-thumbnails.ts
+++ b/server/tests/api/videos/video-playlist-thumbnails.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow, 7 doubleFollow,
8 flushAndRunMultipleServers, 8 createMultipleServers,
9 ServerInfo, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 setDefaultVideoChannel, 11 setDefaultVideoChannel,
12 testImage, 12 testImage,
@@ -17,7 +17,7 @@ import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/
17const expect = chai.expect 17const expect = chai.expect
18 18
19describe('Playlist thumbnail', function () { 19describe('Playlist thumbnail', function () {
20 let servers: ServerInfo[] = [] 20 let servers: PeerTubeServer[] = []
21 21
22 let playlistWithoutThumbnailId: number 22 let playlistWithoutThumbnailId: number
23 let playlistWithThumbnailId: number 23 let playlistWithThumbnailId: number
@@ -30,13 +30,13 @@ describe('Playlist thumbnail', function () {
30 let video1: number 30 let video1: number
31 let video2: number 31 let video2: number
32 32
33 async function getPlaylistWithoutThumbnail (server: ServerInfo) { 33 async function getPlaylistWithoutThumbnail (server: PeerTubeServer) {
34 const body = await server.playlists.list({ start: 0, count: 10 }) 34 const body = await server.playlists.list({ start: 0, count: 10 })
35 35
36 return body.data.find(p => p.displayName === 'playlist without thumbnail') 36 return body.data.find(p => p.displayName === 'playlist without thumbnail')
37 } 37 }
38 38
39 async function getPlaylistWithThumbnail (server: ServerInfo) { 39 async function getPlaylistWithThumbnail (server: PeerTubeServer) {
40 const body = await server.playlists.list({ start: 0, count: 10 }) 40 const body = await server.playlists.list({ start: 0, count: 10 })
41 41
42 return body.data.find(p => p.displayName === 'playlist with thumbnail') 42 return body.data.find(p => p.displayName === 'playlist with thumbnail')
@@ -45,7 +45,7 @@ describe('Playlist thumbnail', function () {
45 before(async function () { 45 before(async function () {
46 this.timeout(120000) 46 this.timeout(120000)
47 47
48 servers = await flushAndRunMultipleServers(2, { transcoding: { enabled: false } }) 48 servers = await createMultipleServers(2, { transcoding: { enabled: false } })
49 49
50 // Get the access tokens 50 // Get the access tokens
51 await setAccessTokensToServers(servers) 51 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts
index 0dc53d4c0..71ca3e63a 100644
--- a/server/tests/api/videos/video-playlists.ts
+++ b/server/tests/api/videos/video-playlists.ts
@@ -7,9 +7,9 @@ import {
7 checkPlaylistFilesWereRemoved, 7 checkPlaylistFilesWereRemoved,
8 cleanupTests, 8 cleanupTests,
9 doubleFollow, 9 doubleFollow,
10 flushAndRunMultipleServers, 10 createMultipleServers,
11 PlaylistsCommand, 11 PlaylistsCommand,
12 ServerInfo, 12 PeerTubeServer,
13 setAccessTokensToServers, 13 setAccessTokensToServers,
14 setDefaultVideoChannel, 14 setDefaultVideoChannel,
15 testImage, 15 testImage,
@@ -28,7 +28,7 @@ import {
28const expect = chai.expect 28const expect = chai.expect
29 29
30async function checkPlaylistElementType ( 30async function checkPlaylistElementType (
31 servers: ServerInfo[], 31 servers: PeerTubeServer[],
32 playlistId: string, 32 playlistId: string,
33 type: VideoPlaylistElementType, 33 type: VideoPlaylistElementType,
34 position: number, 34 position: number,
@@ -52,7 +52,7 @@ async function checkPlaylistElementType (
52} 52}
53 53
54describe('Test video playlists', function () { 54describe('Test video playlists', function () {
55 let servers: ServerInfo[] = [] 55 let servers: PeerTubeServer[] = []
56 56
57 let playlistServer2Id1: number 57 let playlistServer2Id1: number
58 let playlistServer2Id2: number 58 let playlistServer2Id2: number
@@ -75,7 +75,7 @@ describe('Test video playlists', function () {
75 before(async function () { 75 before(async function () {
76 this.timeout(120000) 76 this.timeout(120000)
77 77
78 servers = await flushAndRunMultipleServers(3, { transcoding: { enabled: false } }) 78 servers = await createMultipleServers(3, { transcoding: { enabled: false } })
79 79
80 // Get the access tokens 80 // Get the access tokens
81 await setAccessTokensToServers(servers) 81 await setAccessTokensToServers(servers)
@@ -584,10 +584,10 @@ describe('Test video playlists', function () {
584 }) 584 })
585 585
586 describe('Element type', function () { 586 describe('Element type', function () {
587 let groupUser1: ServerInfo[] 587 let groupUser1: PeerTubeServer[]
588 let groupWithoutToken1: ServerInfo[] 588 let groupWithoutToken1: PeerTubeServer[]
589 let group1: ServerInfo[] 589 let group1: PeerTubeServer[]
590 let group2: ServerInfo[] 590 let group2: PeerTubeServer[]
591 591
592 let video1: string 592 let video1: string
593 let video2: string 593 let video2: string
diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts
index de08a9e7b..5ec626155 100644
--- a/server/tests/api/videos/video-privacy.ts
+++ b/server/tests/api/videos/video-privacy.ts
@@ -3,13 +3,13 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { cleanupTests, doubleFollow, flushAndRunServer, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 6import { cleanupTests, doubleFollow, createSingleServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
7import { VideoCreateResult, VideoPrivacy } from '@shared/models' 7import { VideoCreateResult, VideoPrivacy } from '@shared/models'
8 8
9const expect = chai.expect 9const expect = chai.expect
10 10
11describe('Test video privacy', function () { 11describe('Test video privacy', function () {
12 const servers: ServerInfo[] = [] 12 const servers: PeerTubeServer[] = []
13 let anotherUserToken: string 13 let anotherUserToken: string
14 14
15 let privateVideoId: number 15 let privateVideoId: number
@@ -35,8 +35,8 @@ describe('Test video privacy', function () {
35 this.timeout(50000) 35 this.timeout(50000)
36 36
37 // Run servers 37 // Run servers
38 servers.push(await flushAndRunServer(1, dontFederateUnlistedConfig)) 38 servers.push(await createSingleServer(1, dontFederateUnlistedConfig))
39 servers.push(await flushAndRunServer(2)) 39 servers.push(await createSingleServer(2))
40 40
41 // Get the access tokens 41 // Get the access tokens
42 await setAccessTokensToServers(servers) 42 await setAccessTokensToServers(servers)
diff --git a/server/tests/api/videos/video-schedule-update.ts b/server/tests/api/videos/video-schedule-update.ts
index 3938b47c8..22b5cf1c2 100644
--- a/server/tests/api/videos/video-schedule-update.ts
+++ b/server/tests/api/videos/video-schedule-update.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow, 7 doubleFollow,
8 flushAndRunMultipleServers, 8 createMultipleServers,
9 ServerInfo, 9 PeerTubeServer,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 wait, 11 wait,
12 waitJobs 12 waitJobs
@@ -23,14 +23,14 @@ function in10Seconds () {
23} 23}
24 24
25describe('Test video update scheduler', function () { 25describe('Test video update scheduler', function () {
26 let servers: ServerInfo[] = [] 26 let servers: PeerTubeServer[] = []
27 let video2UUID: string 27 let video2UUID: string
28 28
29 before(async function () { 29 before(async function () {
30 this.timeout(30000) 30 this.timeout(30000)
31 31
32 // Run servers 32 // Run servers
33 servers = await flushAndRunMultipleServers(2) 33 servers = await createMultipleServers(2)
34 34
35 await setAccessTokensToServers(servers) 35 await setAccessTokensToServers(servers)
36 36
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts
index 37450eeeb..2465d2d89 100644
--- a/server/tests/api/videos/video-transcoder.ts
+++ b/server/tests/api/videos/video-transcoder.ts
@@ -9,11 +9,11 @@ import {
9 buildAbsoluteFixturePath, 9 buildAbsoluteFixturePath,
10 cleanupTests, 10 cleanupTests,
11 doubleFollow, 11 doubleFollow,
12 flushAndRunMultipleServers, 12 createMultipleServers,
13 generateHighBitrateVideo, 13 generateHighBitrateVideo,
14 generateVideoWithFramerate, 14 generateVideoWithFramerate,
15 makeGetRequest, 15 makeGetRequest,
16 ServerInfo, 16 PeerTubeServer,
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 waitJobs, 18 waitJobs,
19 webtorrentAdd 19 webtorrentAdd
@@ -31,7 +31,7 @@ import {
31 31
32const expect = chai.expect 32const expect = chai.expect
33 33
34function updateConfigForTranscoding (server: ServerInfo) { 34function updateConfigForTranscoding (server: PeerTubeServer) {
35 return server.config.updateCustomSubConfig({ 35 return server.config.updateCustomSubConfig({
36 newConfig: { 36 newConfig: {
37 transcoding: { 37 transcoding: {
@@ -56,14 +56,14 @@ function updateConfigForTranscoding (server: ServerInfo) {
56} 56}
57 57
58describe('Test video transcoding', function () { 58describe('Test video transcoding', function () {
59 let servers: ServerInfo[] = [] 59 let servers: PeerTubeServer[] = []
60 let video4k: string 60 let video4k: string
61 61
62 before(async function () { 62 before(async function () {
63 this.timeout(30_000) 63 this.timeout(30_000)
64 64
65 // Run servers 65 // Run servers
66 servers = await flushAndRunMultipleServers(2) 66 servers = await createMultipleServers(2)
67 67
68 await setAccessTokensToServers(servers) 68 await setAccessTokensToServers(servers)
69 69
diff --git a/server/tests/api/videos/videos-filter.ts b/server/tests/api/videos/videos-filter.ts
index af1541dbd..db9150655 100644
--- a/server/tests/api/videos/videos-filter.ts
+++ b/server/tests/api/videos/videos-filter.ts
@@ -6,14 +6,14 @@ import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 doubleFollow, 8 doubleFollow,
9 flushAndRunMultipleServers, 9 createMultipleServers,
10 makeGetRequest, 10 makeGetRequest,
11 ServerInfo, 11 PeerTubeServer,
12 setAccessTokensToServers 12 setAccessTokensToServers
13} from '@shared/extra-utils' 13} from '@shared/extra-utils'
14import { UserRole, Video, VideoPrivacy } from '@shared/models' 14import { UserRole, Video, VideoPrivacy } from '@shared/models'
15 15
16async function getVideosNames (server: ServerInfo, token: string, filter: string, statusCodeExpected = HttpStatusCode.OK_200) { 16async function getVideosNames (server: PeerTubeServer, token: string, filter: string, statusCodeExpected = HttpStatusCode.OK_200) {
17 const paths = [ 17 const paths = [
18 '/api/v1/video-channels/root_channel/videos', 18 '/api/v1/video-channels/root_channel/videos',
19 '/api/v1/accounts/root/videos', 19 '/api/v1/accounts/root/videos',
@@ -42,14 +42,14 @@ async function getVideosNames (server: ServerInfo, token: string, filter: string
42} 42}
43 43
44describe('Test videos filter', function () { 44describe('Test videos filter', function () {
45 let servers: ServerInfo[] 45 let servers: PeerTubeServer[]
46 46
47 // --------------------------------------------------------------- 47 // ---------------------------------------------------------------
48 48
49 before(async function () { 49 before(async function () {
50 this.timeout(160000) 50 this.timeout(160000)
51 51
52 servers = await flushAndRunMultipleServers(2) 52 servers = await createMultipleServers(2)
53 53
54 await setAccessTokensToServers(servers) 54 await setAccessTokensToServers(servers)
55 55
diff --git a/server/tests/api/videos/videos-history.ts b/server/tests/api/videos/videos-history.ts
index 4b5e581d1..55e53cb94 100644
--- a/server/tests/api/videos/videos-history.ts
+++ b/server/tests/api/videos/videos-history.ts
@@ -5,11 +5,10 @@ import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 flushAndRunServer, 8 createSingleServer,
9 HistoryCommand, 9 HistoryCommand,
10 killallServers, 10 killallServers,
11 reRunServer, 11 PeerTubeServer,
12 ServerInfo,
13 setAccessTokensToServers, 12 setAccessTokensToServers,
14 wait 13 wait
15} from '@shared/extra-utils' 14} from '@shared/extra-utils'
@@ -18,7 +17,7 @@ import { Video } from '@shared/models'
18const expect = chai.expect 17const expect = chai.expect
19 18
20describe('Test videos history', function () { 19describe('Test videos history', function () {
21 let server: ServerInfo = null 20 let server: PeerTubeServer = null
22 let video1UUID: string 21 let video1UUID: string
23 let video2UUID: string 22 let video2UUID: string
24 let video3UUID: string 23 let video3UUID: string
@@ -29,7 +28,7 @@ describe('Test videos history', function () {
29 before(async function () { 28 before(async function () {
30 this.timeout(30000) 29 this.timeout(30000)
31 30
32 server = await flushAndRunServer(1) 31 server = await createSingleServer(1)
33 32
34 await setAccessTokensToServers([ server ]) 33 await setAccessTokensToServers([ server ])
35 34
@@ -191,7 +190,7 @@ describe('Test videos history', function () {
191 190
192 await killallServers([ server ]) 191 await killallServers([ server ])
193 192
194 await reRunServer(server, { history: { videos: { max_age: '10 days' } } }) 193 await server.run({ history: { videos: { max_age: '10 days' } } })
195 194
196 await wait(6000) 195 await wait(6000)
197 196
@@ -206,7 +205,7 @@ describe('Test videos history', function () {
206 205
207 await killallServers([ server ]) 206 await killallServers([ server ])
208 207
209 await reRunServer(server, { history: { videos: { max_age: '5 seconds' } } }) 208 await server.run({ history: { videos: { max_age: '5 seconds' } } })
210 209
211 await wait(6000) 210 await wait(6000)
212 211
diff --git a/server/tests/api/videos/videos-overview.ts b/server/tests/api/videos/videos-overview.ts
index f0657b334..70aa66549 100644
--- a/server/tests/api/videos/videos-overview.ts
+++ b/server/tests/api/videos/videos-overview.ts
@@ -2,13 +2,13 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers, wait } from '@shared/extra-utils' 5import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils'
6import { VideosOverview } from '@shared/models' 6import { VideosOverview } from '@shared/models'
7 7
8const expect = chai.expect 8const expect = chai.expect
9 9
10describe('Test a videos overview', function () { 10describe('Test a videos overview', function () {
11 let server: ServerInfo = null 11 let server: PeerTubeServer = null
12 12
13 function testOverviewCount (overview: VideosOverview, expected: number) { 13 function testOverviewCount (overview: VideosOverview, expected: number) {
14 expect(overview.tags).to.have.lengthOf(expected) 14 expect(overview.tags).to.have.lengthOf(expected)
@@ -19,7 +19,7 @@ describe('Test a videos overview', function () {
19 before(async function () { 19 before(async function () {
20 this.timeout(30000) 20 this.timeout(30000)
21 21
22 server = await flushAndRunServer(1) 22 server = await createSingleServer(1)
23 23
24 await setAccessTokensToServers([ server ]) 24 await setAccessTokensToServers([ server ])
25 }) 25 })
diff --git a/server/tests/api/videos/videos-views-cleaner.ts b/server/tests/api/videos/videos-views-cleaner.ts
index 238662cf3..0be03ddd2 100644
--- a/server/tests/api/videos/videos-views-cleaner.ts
+++ b/server/tests/api/videos/videos-views-cleaner.ts
@@ -5,10 +5,9 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow, 7 doubleFollow,
8 flushAndRunMultipleServers, 8 createMultipleServers,
9 killallServers, 9 killallServers,
10 reRunServer, 10 PeerTubeServer,
11 ServerInfo,
12 setAccessTokensToServers, 11 setAccessTokensToServers,
13 wait, 12 wait,
14 waitJobs 13 waitJobs
@@ -17,7 +16,7 @@ import {
17const expect = chai.expect 16const expect = chai.expect
18 17
19describe('Test video views cleaner', function () { 18describe('Test video views cleaner', function () {
20 let servers: ServerInfo[] 19 let servers: PeerTubeServer[]
21 20
22 let videoIdServer1: string 21 let videoIdServer1: string
23 let videoIdServer2: string 22 let videoIdServer2: string
@@ -25,7 +24,7 @@ describe('Test video views cleaner', function () {
25 before(async function () { 24 before(async function () {
26 this.timeout(120000) 25 this.timeout(120000)
27 26
28 servers = await flushAndRunMultipleServers(2) 27 servers = await createMultipleServers(2)
29 await setAccessTokensToServers(servers) 28 await setAccessTokensToServers(servers)
30 29
31 await doubleFollow(servers[0], servers[1]) 30 await doubleFollow(servers[0], servers[1])
@@ -48,7 +47,7 @@ describe('Test video views cleaner', function () {
48 47
49 await killallServers([ servers[0] ]) 48 await killallServers([ servers[0] ])
50 49
51 await reRunServer(servers[0], { views: { videos: { remote: { max_age: '10 days' } } } }) 50 await servers[0].run({ views: { videos: { remote: { max_age: '10 days' } } } })
52 51
53 await wait(6000) 52 await wait(6000)
54 53
@@ -74,7 +73,7 @@ describe('Test video views cleaner', function () {
74 73
75 await killallServers([ servers[0] ]) 74 await killallServers([ servers[0] ])
76 75
77 await reRunServer(servers[0], { views: { videos: { remote: { max_age: '5 seconds' } } } }) 76 await servers[0].run({ views: { videos: { remote: { max_age: '5 seconds' } } } })
78 77
79 await wait(6000) 78 await wait(6000)
80 79