aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins/plugin-transcoding.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-07 11:51:09 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:17 +0200
commit65e6e2602c0d5521f3a6740f7469bb92830ecb53 (patch)
treef89024ffff1dafb0281ee2fe028e89b95101bd44 /server/tests/plugins/plugin-transcoding.ts
parentbc8090411ddaa8d742ce4de3c83f9dba7bc18e2a (diff)
downloadPeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.tar.gz
PeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.tar.zst
PeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.zip
Introduce config command
Diffstat (limited to 'server/tests/plugins/plugin-transcoding.ts')
-rw-r--r--server/tests/plugins/plugin-transcoding.ts50
1 files changed, 24 insertions, 26 deletions
diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts
index f1ff91077..71c2adc72 100644
--- a/server/tests/plugins/plugin-transcoding.ts
+++ b/server/tests/plugins/plugin-transcoding.ts
@@ -9,7 +9,6 @@ import {
9 cleanupTests, 9 cleanupTests,
10 createLive, 10 createLive,
11 flushAndRunServer, 11 flushAndRunServer,
12 getConfig,
13 getVideo, 12 getVideo,
14 PluginsCommand, 13 PluginsCommand,
15 sendRTMPStreamInVideo, 14 sendRTMPStreamInVideo,
@@ -17,12 +16,11 @@ import {
17 setAccessTokensToServers, 16 setAccessTokensToServers,
18 setDefaultVideoChannel, 17 setDefaultVideoChannel,
19 testFfmpegStreamError, 18 testFfmpegStreamError,
20 updateCustomSubConfig,
21 uploadVideoAndGetId, 19 uploadVideoAndGetId,
22 waitJobs, 20 waitJobs,
23 waitUntilLivePublished 21 waitUntilLivePublished
24} from '@shared/extra-utils' 22} from '@shared/extra-utils'
25import { ServerConfig, VideoDetails, VideoPrivacy } from '@shared/models' 23import { VideoDetails, VideoPrivacy } from '@shared/models'
26 24
27async function createLiveWrapper (server: ServerInfo) { 25async function createLiveWrapper (server: ServerInfo) {
28 const liveAttributes = { 26 const liveAttributes = {
@@ -36,33 +34,35 @@ async function createLiveWrapper (server: ServerInfo) {
36} 34}
37 35
38function updateConf (server: ServerInfo, vodProfile: string, liveProfile: string) { 36function updateConf (server: ServerInfo, vodProfile: string, liveProfile: string) {
39 return updateCustomSubConfig(server.url, server.accessToken, { 37 return server.configCommand.updateCustomSubConfig({
40 transcoding: { 38 newConfig: {
41 enabled: true,
42 profile: vodProfile,
43 hls: {
44 enabled: true
45 },
46 webtorrent: {
47 enabled: true
48 },
49 resolutions: {
50 '240p': true,
51 '360p': false,
52 '480p': false,
53 '720p': true
54 }
55 },
56 live: {
57 transcoding: { 39 transcoding: {
58 profile: liveProfile,
59 enabled: true, 40 enabled: true,
41 profile: vodProfile,
42 hls: {
43 enabled: true
44 },
45 webtorrent: {
46 enabled: true
47 },
60 resolutions: { 48 resolutions: {
61 '240p': true, 49 '240p': true,
62 '360p': false, 50 '360p': false,
63 '480p': false, 51 '480p': false,
64 '720p': true 52 '720p': true
65 } 53 }
54 },
55 live: {
56 transcoding: {
57 profile: liveProfile,
58 enabled: true,
59 resolutions: {
60 '240p': true,
61 '360p': false,
62 '480p': false,
63 '720p': true
64 }
65 }
66 } 66 }
67 } 67 }
68 }) 68 })
@@ -113,8 +113,7 @@ describe('Test transcoding plugins', function () {
113 }) 113 })
114 114
115 it('Should have the appropriate available profiles', async function () { 115 it('Should have the appropriate available profiles', async function () {
116 const res = await getConfig(server.url) 116 const config = await server.configCommand.getConfig()
117 const config = res.body as ServerConfig
118 117
119 expect(config.transcoding.availableProfiles).to.have.members([ 'default', 'low-vod', 'input-options-vod', 'bad-scale-vod' ]) 118 expect(config.transcoding.availableProfiles).to.have.members([ 'default', 'low-vod', 'input-options-vod', 'bad-scale-vod' ])
120 expect(config.live.transcoding.availableProfiles).to.have.members([ 'default', 'low-live', 'input-options-live', 'bad-scale-live' ]) 119 expect(config.live.transcoding.availableProfiles).to.have.members([ 'default', 'low-live', 'input-options-live', 'bad-scale-live' ])
@@ -223,8 +222,7 @@ describe('Test transcoding plugins', function () {
223 222
224 await server.pluginsCommand.uninstall({ npmName: 'peertube-plugin-test-transcoding-one' }) 223 await server.pluginsCommand.uninstall({ npmName: 'peertube-plugin-test-transcoding-one' })
225 224
226 const res = await getConfig(server.url) 225 const config = await server.configCommand.getConfig()
227 const config = res.body as ServerConfig
228 226
229 expect(config.transcoding.availableProfiles).to.deep.equal([ 'default' ]) 227 expect(config.transcoding.availableProfiles).to.deep.equal([ 'default' ])
230 expect(config.live.transcoding.availableProfiles).to.deep.equal([ 'default' ]) 228 expect(config.live.transcoding.availableProfiles).to.deep.equal([ 'default' ])