aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
diff options
context:
space:
mode:
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>2022-06-21 15:31:25 +0200
committerGitHub <noreply@github.com>2022-06-21 15:31:25 +0200
commit2e401e8575decb1d491d0db48ca1ab1eba5b2a66 (patch)
treeeee1e6213ca4d635837ca01c2bdc5c876b8d8b7d /server/tests/api/videos
parentdec49521556fc228c6e05b6199e9b07f619b38fb (diff)
downloadPeerTube-2e401e8575decb1d491d0db48ca1ab1eba5b2a66.tar.gz
PeerTube-2e401e8575decb1d491d0db48ca1ab1eba5b2a66.tar.zst
PeerTube-2e401e8575decb1d491d0db48ca1ab1eba5b2a66.zip
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 <me@florianbigard.com>
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r--server/tests/api/videos/index.ts1
-rw-r--r--server/tests/api/videos/video-source.ts39
2 files changed, 40 insertions, 0 deletions
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'
16import './videos-common-filters' 16import './videos-common-filters'
17import './videos-history' 17import './videos-history'
18import './videos-overview' 18import './videos-overview'
19import './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 @@
1import 'mocha'
2import * as chai from 'chai'
3import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands'
4
5const expect = chai.expect
6
7describe('Test video source', () => {
8 let server: PeerTubeServer = null
9 const fixture = 'video_short.webm'
10
11 before(async function () {
12 this.timeout(30000)
13
14 server = await createSingleServer(1)
15 await setAccessTokensToServers([ server ])
16 })
17
18 it('Should get the source filename with legacy upload', async function () {
19 this.timeout(30000)
20
21 const { uuid } = await server.videos.upload({ attributes: { name: 'my video', fixture }, mode: 'legacy' })
22
23 const source = await server.videos.getSource({ id: uuid })
24 expect(source.filename).to.equal(fixture)
25 })
26
27 it('Should get the source filename with resumable upload', async function () {
28 this.timeout(30000)
29
30 const { uuid } = await server.videos.upload({ attributes: { name: 'my video', fixture }, mode: 'resumable' })
31
32 const source = await server.videos.getSource({ id: uuid })
33 expect(source.filename).to.equal(fixture)
34 })
35
36 after(async function () {
37 await cleanupTests([ server ])
38 })
39})