aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-source.ts
blob: e346423008a8dc75e5c145f05df316d8ebf2559b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import 'mocha'
import * as chai from 'chai'
import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'

const expect = chai.expect

describe('Test video source', () => {
  let server: PeerTubeServer = null
  const fixture = 'video_short.webm'

  before(async function () {
    this.timeout(30000)

    server = await createSingleServer(1)
    await setAccessTokensToServers([ server ])
  })

  it('Should get the source filename with legacy upload', async function () {
    this.timeout(30000)

    const { uuid } = await server.videos.upload({ attributes: { name: 'my video', fixture }, mode: 'legacy' })

    const source = await server.videos.getSource({ id: uuid })
    expect(source.filename).to.equal(fixture)
  })

  it('Should get the source filename with resumable upload', async function () {
    this.timeout(30000)

    const { uuid } = await server.videos.upload({ attributes: { name: 'my video', fixture }, mode: 'resumable' })

    const source = await server.videos.getSource({ id: uuid })
    expect(source.filename).to.equal(fixture)
  })

  after(async function () {
    await cleanupTests([ server ])
  })
})