From 2e401e8575decb1d491d0db48ca1ab1eba5b2a66 Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Tue, 21 Jun 2022 15:31:25 +0200 Subject: store uploaded video filename (#4885) * store uploaded video filename closes #4731 * dont crash if videos channel exist * migration: use raw query * video source: fixes after code review * cleanup * bump migration * updates after code review * refactor: use checkUserCanManageVideo * videoSource: add openapi doc * test(check-params/video-source): fix timeout * Styling * Correctly set original filename as source Co-authored-by: Chocobozzz --- server/tests/api/videos/index.ts | 1 + server/tests/api/videos/video-source.ts | 39 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 server/tests/api/videos/video-source.ts (limited to 'server/tests/api/videos') diff --git a/server/tests/api/videos/index.ts b/server/tests/api/videos/index.ts index 27b119f30..a0b6b01cf 100644 --- a/server/tests/api/videos/index.ts +++ b/server/tests/api/videos/index.ts @@ -16,3 +16,4 @@ import './video-schedule-update' import './videos-common-filters' import './videos-history' import './videos-overview' +import './video-source' diff --git a/server/tests/api/videos/video-source.ts b/server/tests/api/videos/video-source.ts new file mode 100644 index 000000000..e34642300 --- /dev/null +++ b/server/tests/api/videos/video-source.ts @@ -0,0 +1,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 ]) + }) +}) -- cgit v1.2.3