aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/audio-only.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos/audio-only.ts')
-rw-r--r--server/tests/api/videos/audio-only.ts29
1 files changed, 8 insertions, 21 deletions
diff --git a/server/tests/api/videos/audio-only.ts b/server/tests/api/videos/audio-only.ts
index 7ddbd5cd9..15c3ae6d6 100644
--- a/server/tests/api/videos/audio-only.ts
+++ b/server/tests/api/videos/audio-only.ts
@@ -4,23 +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 { 7import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
8 buildServerDirectory,
9 cleanupTests,
10 doubleFollow,
11 flushAndRunMultipleServers,
12 getVideo,
13 ServerInfo,
14 setAccessTokensToServers,
15 uploadVideo,
16 waitJobs
17} from '../../../../shared/extra-utils'
18import { VideoDetails } from '../../../../shared/models/videos'
19 8
20const expect = chai.expect 9const expect = chai.expect
21 10
22describe('Test audio only video transcoding', function () { 11describe('Test audio only video transcoding', function () {
23 let servers: ServerInfo[] = [] 12 let servers: PeerTubeServer[] = []
24 let videoUUID: string 13 let videoUUID: string
25 14
26 before(async function () { 15 before(async function () {
@@ -47,7 +36,7 @@ describe('Test audio only video transcoding', function () {
47 } 36 }
48 } 37 }
49 } 38 }
50 servers = await flushAndRunMultipleServers(2, configOverride) 39 servers = await createMultipleServers(2, configOverride)
51 40
52 // Get the access tokens 41 // Get the access tokens
53 await setAccessTokensToServers(servers) 42 await setAccessTokensToServers(servers)
@@ -59,15 +48,13 @@ describe('Test audio only video transcoding', function () {
59 it('Should upload a video and transcode it', async function () { 48 it('Should upload a video and transcode it', async function () {
60 this.timeout(120000) 49 this.timeout(120000)
61 50
62 const resUpload = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'audio only' }) 51 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'audio only' } })
63 videoUUID = resUpload.body.video.uuid 52 videoUUID = uuid
64 53
65 await waitJobs(servers) 54 await waitJobs(servers)
66 55
67 for (const server of servers) { 56 for (const server of servers) {
68 const res = await getVideo(server.url, videoUUID) 57 const video = await server.videos.get({ id: videoUUID })
69 const video: VideoDetails = res.body
70
71 expect(video.streamingPlaylists).to.have.lengthOf(1) 58 expect(video.streamingPlaylists).to.have.lengthOf(1)
72 59
73 for (const files of [ video.files, video.streamingPlaylists[0].files ]) { 60 for (const files of [ video.files, video.streamingPlaylists[0].files ]) {
@@ -81,8 +68,8 @@ describe('Test audio only video transcoding', function () {
81 68
82 it('0p transcoded video should not have video', async function () { 69 it('0p transcoded video should not have video', async function () {
83 const paths = [ 70 const paths = [
84 buildServerDirectory(servers[0], join('videos', videoUUID + '-0.mp4')), 71 servers[0].servers.buildDirectory(join('videos', videoUUID + '-0.mp4')),
85 buildServerDirectory(servers[0], join('streaming-playlists', 'hls', videoUUID, videoUUID + '-0-fragmented.mp4')) 72 servers[0].servers.buildDirectory(join('streaming-playlists', 'hls', videoUUID, videoUUID + '-0-fragmented.mp4'))
86 ] 73 ]
87 74
88 for (const path of paths) { 75 for (const path of paths) {