]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/tests/api/videos/video-source.ts
4c1641ed079a40dd6083d240e346623871dc42bb
[github/Chocobozzz/PeerTube.git] / server / tests / api / videos / video-source.ts
1 import * as chai from 'chai'
2 import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'
3
4 const expect = chai.expect
5
6 describe('Test video source', () => {
7 let server: PeerTubeServer = null
8 const fixture = 'video_short.webm'
9
10 before(async function () {
11 this.timeout(30000)
12
13 server = await createSingleServer(1)
14 await setAccessTokensToServers([ server ])
15 })
16
17 it('Should get the source filename with legacy upload', async function () {
18 this.timeout(30000)
19
20 const { uuid } = await server.videos.upload({ attributes: { name: 'my video', fixture }, mode: 'legacy' })
21
22 const source = await server.videos.getSource({ id: uuid })
23 expect(source.filename).to.equal(fixture)
24 })
25
26 it('Should get the source filename with resumable upload', async function () {
27 this.timeout(30000)
28
29 const { uuid } = await server.videos.upload({ attributes: { name: 'my video', fixture }, mode: 'resumable' })
30
31 const source = await server.videos.getSource({ id: uuid })
32 expect(source.filename).to.equal(fixture)
33 })
34
35 after(async function () {
36 await cleanupTests([ server ])
37 })
38 })