video-source.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { expect } from 'chai'
  2. import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'
  3. describe('Test video source', () => {
  4. let server: PeerTubeServer = null
  5. const fixture = 'video_short.webm'
  6. before(async function () {
  7. this.timeout(30000)
  8. server = await createSingleServer(1)
  9. await setAccessTokensToServers([ server ])
  10. })
  11. it('Should get the source filename with legacy upload', async function () {
  12. this.timeout(30000)
  13. const { uuid } = await server.videos.upload({ attributes: { name: 'my video', fixture }, mode: 'legacy' })
  14. const source = await server.videos.getSource({ id: uuid })
  15. expect(source.filename).to.equal(fixture)
  16. })
  17. it('Should get the source filename with resumable upload', async function () {
  18. this.timeout(30000)
  19. const { uuid } = await server.videos.upload({ attributes: { name: 'my video', fixture }, mode: 'resumable' })
  20. const source = await server.videos.getSource({ id: uuid })
  21. expect(source.filename).to.equal(fixture)
  22. })
  23. after(async function () {
  24. await cleanupTests([ server ])
  25. })
  26. })