diff options
Diffstat (limited to 'server/tests/api/live/live.ts')
-rw-r--r-- | server/tests/api/live/live.ts | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts index c88143982..2cce1f448 100644 --- a/server/tests/api/live/live.ts +++ b/server/tests/api/live/live.ts | |||
@@ -44,7 +44,7 @@ describe('Test live', function () { | |||
44 | await setAccessTokensToServers(servers) | 44 | await setAccessTokensToServers(servers) |
45 | await setDefaultVideoChannel(servers) | 45 | await setDefaultVideoChannel(servers) |
46 | 46 | ||
47 | await servers[0].configCommand.updateCustomSubConfig({ | 47 | await servers[0].config.updateCustomSubConfig({ |
48 | newConfig: { | 48 | newConfig: { |
49 | live: { | 49 | live: { |
50 | enabled: true, | 50 | enabled: true, |
@@ -59,7 +59,7 @@ describe('Test live', function () { | |||
59 | // Server 1 and server 2 follow each other | 59 | // Server 1 and server 2 follow each other |
60 | await doubleFollow(servers[0], servers[1]) | 60 | await doubleFollow(servers[0], servers[1]) |
61 | 61 | ||
62 | commands = servers.map(s => s.liveCommand) | 62 | commands = servers.map(s => s.live) |
63 | }) | 63 | }) |
64 | 64 | ||
65 | describe('Live creation, update and delete', function () { | 65 | describe('Live creation, update and delete', function () { |
@@ -74,7 +74,7 @@ describe('Test live', function () { | |||
74 | language: 'fr', | 74 | language: 'fr', |
75 | description: 'super live description', | 75 | description: 'super live description', |
76 | support: 'support field', | 76 | support: 'support field', |
77 | channelId: servers[0].videoChannel.id, | 77 | channelId: servers[0].store.channel.id, |
78 | nsfw: false, | 78 | nsfw: false, |
79 | waitTranscoding: false, | 79 | waitTranscoding: false, |
80 | name: 'my super live', | 80 | name: 'my super live', |
@@ -93,7 +93,7 @@ describe('Test live', function () { | |||
93 | await waitJobs(servers) | 93 | await waitJobs(servers) |
94 | 94 | ||
95 | for (const server of servers) { | 95 | for (const server of servers) { |
96 | const video = await server.videosCommand.get({ id: liveVideoUUID }) | 96 | const video = await server.videos.get({ id: liveVideoUUID }) |
97 | 97 | ||
98 | expect(video.category.id).to.equal(1) | 98 | expect(video.category.id).to.equal(1) |
99 | expect(video.licence.id).to.equal(2) | 99 | expect(video.licence.id).to.equal(2) |
@@ -101,8 +101,8 @@ describe('Test live', function () { | |||
101 | expect(video.description).to.equal('super live description') | 101 | expect(video.description).to.equal('super live description') |
102 | expect(video.support).to.equal('support field') | 102 | expect(video.support).to.equal('support field') |
103 | 103 | ||
104 | expect(video.channel.name).to.equal(servers[0].videoChannel.name) | 104 | expect(video.channel.name).to.equal(servers[0].store.channel.name) |
105 | expect(video.channel.host).to.equal(servers[0].videoChannel.host) | 105 | expect(video.channel.host).to.equal(servers[0].store.channel.host) |
106 | 106 | ||
107 | expect(video.isLive).to.be.true | 107 | expect(video.isLive).to.be.true |
108 | 108 | ||
@@ -117,7 +117,7 @@ describe('Test live', function () { | |||
117 | await testImage(server.url, 'video_short1-preview.webm', video.previewPath) | 117 | await testImage(server.url, 'video_short1-preview.webm', video.previewPath) |
118 | await testImage(server.url, 'video_short1.webm', video.thumbnailPath) | 118 | await testImage(server.url, 'video_short1.webm', video.thumbnailPath) |
119 | 119 | ||
120 | const live = await server.liveCommand.get({ videoId: liveVideoUUID }) | 120 | const live = await server.live.get({ videoId: liveVideoUUID }) |
121 | 121 | ||
122 | if (server.url === servers[0].url) { | 122 | if (server.url === servers[0].url) { |
123 | expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live') | 123 | expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live') |
@@ -136,7 +136,7 @@ describe('Test live', function () { | |||
136 | 136 | ||
137 | const attributes: LiveVideoCreate = { | 137 | const attributes: LiveVideoCreate = { |
138 | name: 'default live thumbnail', | 138 | name: 'default live thumbnail', |
139 | channelId: servers[0].videoChannel.id, | 139 | channelId: servers[0].store.channel.id, |
140 | privacy: VideoPrivacy.UNLISTED, | 140 | privacy: VideoPrivacy.UNLISTED, |
141 | nsfw: true | 141 | nsfw: true |
142 | } | 142 | } |
@@ -147,7 +147,7 @@ describe('Test live', function () { | |||
147 | await waitJobs(servers) | 147 | await waitJobs(servers) |
148 | 148 | ||
149 | for (const server of servers) { | 149 | for (const server of servers) { |
150 | const video = await server.videosCommand.get({ id: videoId }) | 150 | const video = await server.videos.get({ id: videoId }) |
151 | expect(video.privacy.id).to.equal(VideoPrivacy.UNLISTED) | 151 | expect(video.privacy.id).to.equal(VideoPrivacy.UNLISTED) |
152 | expect(video.nsfw).to.be.true | 152 | expect(video.nsfw).to.be.true |
153 | 153 | ||
@@ -158,7 +158,7 @@ describe('Test live', function () { | |||
158 | 158 | ||
159 | it('Should not have the live listed since nobody streams into', async function () { | 159 | it('Should not have the live listed since nobody streams into', async function () { |
160 | for (const server of servers) { | 160 | for (const server of servers) { |
161 | const { total, data } = await server.videosCommand.list() | 161 | const { total, data } = await server.videos.list() |
162 | 162 | ||
163 | expect(total).to.equal(0) | 163 | expect(total).to.equal(0) |
164 | expect(data).to.have.lengthOf(0) | 164 | expect(data).to.have.lengthOf(0) |
@@ -178,7 +178,7 @@ describe('Test live', function () { | |||
178 | 178 | ||
179 | it('Have the live updated', async function () { | 179 | it('Have the live updated', async function () { |
180 | for (const server of servers) { | 180 | for (const server of servers) { |
181 | const live = await server.liveCommand.get({ videoId: liveVideoUUID }) | 181 | const live = await server.live.get({ videoId: liveVideoUUID }) |
182 | 182 | ||
183 | if (server.url === servers[0].url) { | 183 | if (server.url === servers[0].url) { |
184 | expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live') | 184 | expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live') |
@@ -195,14 +195,14 @@ describe('Test live', function () { | |||
195 | it('Delete the live', async function () { | 195 | it('Delete the live', async function () { |
196 | this.timeout(10000) | 196 | this.timeout(10000) |
197 | 197 | ||
198 | await servers[0].videosCommand.remove({ id: liveVideoUUID }) | 198 | await servers[0].videos.remove({ id: liveVideoUUID }) |
199 | await waitJobs(servers) | 199 | await waitJobs(servers) |
200 | }) | 200 | }) |
201 | 201 | ||
202 | it('Should have the live deleted', async function () { | 202 | it('Should have the live deleted', async function () { |
203 | for (const server of servers) { | 203 | for (const server of servers) { |
204 | await server.videosCommand.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | 204 | await server.videos.get({ id: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
205 | await server.liveCommand.get({ videoId: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | 205 | await server.live.get({ videoId: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
206 | } | 206 | } |
207 | }) | 207 | }) |
208 | }) | 208 | }) |
@@ -215,19 +215,19 @@ describe('Test live', function () { | |||
215 | before(async function () { | 215 | before(async function () { |
216 | this.timeout(120000) | 216 | this.timeout(120000) |
217 | 217 | ||
218 | vodVideoId = (await servers[0].videosCommand.quickUpload({ name: 'vod video' })).uuid | 218 | vodVideoId = (await servers[0].videos.quickUpload({ name: 'vod video' })).uuid |
219 | 219 | ||
220 | const liveOptions = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: servers[0].videoChannel.id } | 220 | const liveOptions = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: servers[0].store.channel.id } |
221 | const live = await commands[0].create({ fields: liveOptions }) | 221 | const live = await commands[0].create({ fields: liveOptions }) |
222 | liveVideoId = live.uuid | 222 | liveVideoId = live.uuid |
223 | 223 | ||
224 | ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId }) | 224 | ffmpegCommand = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveVideoId }) |
225 | await waitUntilLivePublishedOnAllServers(servers, liveVideoId) | 225 | await waitUntilLivePublishedOnAllServers(servers, liveVideoId) |
226 | await waitJobs(servers) | 226 | await waitJobs(servers) |
227 | }) | 227 | }) |
228 | 228 | ||
229 | it('Should only display lives', async function () { | 229 | it('Should only display lives', async function () { |
230 | const { data, total } = await servers[0].videosCommand.list({ isLive: true }) | 230 | const { data, total } = await servers[0].videos.list({ isLive: true }) |
231 | 231 | ||
232 | expect(total).to.equal(1) | 232 | expect(total).to.equal(1) |
233 | expect(data).to.have.lengthOf(1) | 233 | expect(data).to.have.lengthOf(1) |
@@ -235,7 +235,7 @@ describe('Test live', function () { | |||
235 | }) | 235 | }) |
236 | 236 | ||
237 | it('Should not display lives', async function () { | 237 | it('Should not display lives', async function () { |
238 | const { data, total } = await servers[0].videosCommand.list({ isLive: false }) | 238 | const { data, total } = await servers[0].videos.list({ isLive: false }) |
239 | 239 | ||
240 | expect(total).to.equal(1) | 240 | expect(total).to.equal(1) |
241 | expect(data).to.have.lengthOf(1) | 241 | expect(data).to.have.lengthOf(1) |
@@ -248,22 +248,22 @@ describe('Test live', function () { | |||
248 | await stopFfmpeg(ffmpegCommand) | 248 | await stopFfmpeg(ffmpegCommand) |
249 | await waitJobs(servers) | 249 | await waitJobs(servers) |
250 | 250 | ||
251 | const { data } = await servers[0].videosCommand.listMyVideos({ isLive: true }) | 251 | const { data } = await servers[0].videos.listMyVideos({ isLive: true }) |
252 | 252 | ||
253 | const result = data.every(v => v.isLive) | 253 | const result = data.every(v => v.isLive) |
254 | expect(result).to.be.true | 254 | expect(result).to.be.true |
255 | }) | 255 | }) |
256 | 256 | ||
257 | it('Should not display my lives', async function () { | 257 | it('Should not display my lives', async function () { |
258 | const { data } = await servers[0].videosCommand.listMyVideos({ isLive: false }) | 258 | const { data } = await servers[0].videos.listMyVideos({ isLive: false }) |
259 | 259 | ||
260 | const result = data.every(v => !v.isLive) | 260 | const result = data.every(v => !v.isLive) |
261 | expect(result).to.be.true | 261 | expect(result).to.be.true |
262 | }) | 262 | }) |
263 | 263 | ||
264 | after(async function () { | 264 | after(async function () { |
265 | await servers[0].videosCommand.remove({ id: vodVideoId }) | 265 | await servers[0].videos.remove({ id: vodVideoId }) |
266 | await servers[0].videosCommand.remove({ id: liveVideoId }) | 266 | await servers[0].videos.remove({ id: liveVideoId }) |
267 | }) | 267 | }) |
268 | }) | 268 | }) |
269 | 269 | ||
@@ -278,7 +278,7 @@ describe('Test live', function () { | |||
278 | async function createLiveWrapper () { | 278 | async function createLiveWrapper () { |
279 | const liveAttributes = { | 279 | const liveAttributes = { |
280 | name: 'user live', | 280 | name: 'user live', |
281 | channelId: servers[0].videoChannel.id, | 281 | channelId: servers[0].store.channel.id, |
282 | privacy: VideoPrivacy.PUBLIC, | 282 | privacy: VideoPrivacy.PUBLIC, |
283 | saveReplay: false | 283 | saveReplay: false |
284 | } | 284 | } |
@@ -286,7 +286,7 @@ describe('Test live', function () { | |||
286 | const { uuid } = await commands[0].create({ fields: liveAttributes }) | 286 | const { uuid } = await commands[0].create({ fields: liveAttributes }) |
287 | 287 | ||
288 | const live = await commands[0].get({ videoId: uuid }) | 288 | const live = await commands[0].get({ videoId: uuid }) |
289 | const video = await servers[0].videosCommand.get({ id: uuid }) | 289 | const video = await servers[0].videos.get({ id: uuid }) |
290 | 290 | ||
291 | return Object.assign(video, live) | 291 | return Object.assign(video, live) |
292 | } | 292 | } |
@@ -316,7 +316,7 @@ describe('Test live', function () { | |||
316 | 316 | ||
317 | it('Should list this live now someone stream into it', async function () { | 317 | it('Should list this live now someone stream into it', async function () { |
318 | for (const server of servers) { | 318 | for (const server of servers) { |
319 | const { total, data } = await server.videosCommand.list() | 319 | const { total, data } = await server.videos.list() |
320 | 320 | ||
321 | expect(total).to.equal(1) | 321 | expect(total).to.equal(1) |
322 | expect(data).to.have.lengthOf(1) | 322 | expect(data).to.have.lengthOf(1) |
@@ -332,7 +332,7 @@ describe('Test live', function () { | |||
332 | 332 | ||
333 | liveVideo = await createLiveWrapper() | 333 | liveVideo = await createLiveWrapper() |
334 | 334 | ||
335 | await servers[0].blacklistCommand.add({ videoId: liveVideo.uuid }) | 335 | await servers[0].blacklist.add({ videoId: liveVideo.uuid }) |
336 | 336 | ||
337 | const command = sendRTMPStream(rtmpUrl + '/live', liveVideo.streamKey) | 337 | const command = sendRTMPStream(rtmpUrl + '/live', liveVideo.streamKey) |
338 | await testFfmpegStreamError(command, true) | 338 | await testFfmpegStreamError(command, true) |
@@ -343,7 +343,7 @@ describe('Test live', function () { | |||
343 | 343 | ||
344 | liveVideo = await createLiveWrapper() | 344 | liveVideo = await createLiveWrapper() |
345 | 345 | ||
346 | await servers[0].videosCommand.remove({ id: liveVideo.uuid }) | 346 | await servers[0].videos.remove({ id: liveVideo.uuid }) |
347 | 347 | ||
348 | const command = sendRTMPStream(rtmpUrl + '/live', liveVideo.streamKey) | 348 | const command = sendRTMPStream(rtmpUrl + '/live', liveVideo.streamKey) |
349 | await testFfmpegStreamError(command, true) | 349 | await testFfmpegStreamError(command, true) |
@@ -356,7 +356,7 @@ describe('Test live', function () { | |||
356 | async function createLiveWrapper (saveReplay: boolean) { | 356 | async function createLiveWrapper (saveReplay: boolean) { |
357 | const liveAttributes = { | 357 | const liveAttributes = { |
358 | name: 'live video', | 358 | name: 'live video', |
359 | channelId: servers[0].videoChannel.id, | 359 | channelId: servers[0].store.channel.id, |
360 | privacy: VideoPrivacy.PUBLIC, | 360 | privacy: VideoPrivacy.PUBLIC, |
361 | saveReplay | 361 | saveReplay |
362 | } | 362 | } |
@@ -367,10 +367,10 @@ describe('Test live', function () { | |||
367 | 367 | ||
368 | async function testVideoResolutions (liveVideoId: string, resolutions: number[]) { | 368 | async function testVideoResolutions (liveVideoId: string, resolutions: number[]) { |
369 | for (const server of servers) { | 369 | for (const server of servers) { |
370 | const { data } = await server.videosCommand.list() | 370 | const { data } = await server.videos.list() |
371 | expect(data.find(v => v.uuid === liveVideoId)).to.exist | 371 | expect(data.find(v => v.uuid === liveVideoId)).to.exist |
372 | 372 | ||
373 | const video = await server.videosCommand.get({ id: liveVideoId }) | 373 | const video = await server.videos.get({ id: liveVideoId }) |
374 | 374 | ||
375 | expect(video.streamingPlaylists).to.have.lengthOf(1) | 375 | expect(video.streamingPlaylists).to.have.lengthOf(1) |
376 | 376 | ||
@@ -387,7 +387,7 @@ describe('Test live', function () { | |||
387 | const segmentName = `${i}-00000${segmentNum}.ts` | 387 | const segmentName = `${i}-00000${segmentNum}.ts` |
388 | await commands[0].waitUntilSegmentGeneration({ videoUUID: video.uuid, resolution: i, segment: segmentNum }) | 388 | await commands[0].waitUntilSegmentGeneration({ videoUUID: video.uuid, resolution: i, segment: segmentNum }) |
389 | 389 | ||
390 | const subPlaylist = await servers[0].streamingPlaylistsCommand.get({ | 390 | const subPlaylist = await servers[0].streamingPlaylists.get({ |
391 | url: `${servers[0].url}/static/streaming-playlists/hls/${video.uuid}/${i}.m3u8` | 391 | url: `${servers[0].url}/static/streaming-playlists/hls/${video.uuid}/${i}.m3u8` |
392 | }) | 392 | }) |
393 | 393 | ||
@@ -406,7 +406,7 @@ describe('Test live', function () { | |||
406 | } | 406 | } |
407 | 407 | ||
408 | function updateConf (resolutions: number[]) { | 408 | function updateConf (resolutions: number[]) { |
409 | return servers[0].configCommand.updateCustomSubConfig({ | 409 | return servers[0].config.updateCustomSubConfig({ |
410 | newConfig: { | 410 | newConfig: { |
411 | live: { | 411 | live: { |
412 | enabled: true, | 412 | enabled: true, |
@@ -490,7 +490,7 @@ describe('Test live', function () { | |||
490 | } | 490 | } |
491 | 491 | ||
492 | for (const server of servers) { | 492 | for (const server of servers) { |
493 | const video = await server.videosCommand.get({ id: liveVideoId }) | 493 | const video = await server.videos.get({ id: liveVideoId }) |
494 | 494 | ||
495 | expect(video.state.id).to.equal(VideoState.PUBLISHED) | 495 | expect(video.state.id).to.equal(VideoState.PUBLISHED) |
496 | expect(video.duration).to.be.greaterThan(1) | 496 | expect(video.duration).to.be.greaterThan(1) |
@@ -515,7 +515,7 @@ describe('Test live', function () { | |||
515 | } | 515 | } |
516 | 516 | ||
517 | const filename = `${video.uuid}-${resolution}-fragmented.mp4` | 517 | const filename = `${video.uuid}-${resolution}-fragmented.mp4` |
518 | const segmentPath = servers[0].serversCommand.buildDirectory(join('streaming-playlists', 'hls', video.uuid, filename)) | 518 | const segmentPath = servers[0].servers.buildDirectory(join('streaming-playlists', 'hls', video.uuid, filename)) |
519 | 519 | ||
520 | const probe = await ffprobePromise(segmentPath) | 520 | const probe = await ffprobePromise(segmentPath) |
521 | const videoStream = await getVideoStreamFromFile(segmentPath, probe) | 521 | const videoStream = await getVideoStreamFromFile(segmentPath, probe) |
@@ -542,7 +542,7 @@ describe('Test live', function () { | |||
542 | async function createLiveWrapper (saveReplay: boolean) { | 542 | async function createLiveWrapper (saveReplay: boolean) { |
543 | const liveAttributes = { | 543 | const liveAttributes = { |
544 | name: 'live video', | 544 | name: 'live video', |
545 | channelId: servers[0].videoChannel.id, | 545 | channelId: servers[0].store.channel.id, |
546 | privacy: VideoPrivacy.PUBLIC, | 546 | privacy: VideoPrivacy.PUBLIC, |
547 | saveReplay | 547 | saveReplay |
548 | } | 548 | } |