diff options
author | kontrollanten <6680299+kontrollanten@users.noreply.github.com> | 2022-06-21 15:31:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-21 15:31:25 +0200 |
commit | 2e401e8575decb1d491d0db48ca1ab1eba5b2a66 (patch) | |
tree | eee1e6213ca4d635837ca01c2bdc5c876b8d8b7d /server/tests/api/videos/video-source.ts | |
parent | dec49521556fc228c6e05b6199e9b07f619b38fb (diff) | |
download | PeerTube-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/video-source.ts')
-rw-r--r-- | server/tests/api/videos/video-source.ts | 39 |
1 files changed, 39 insertions, 0 deletions
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 @@ | |||
1 | import 'mocha' | ||
2 | import * as chai from 'chai' | ||
3 | import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/server-commands' | ||
4 | |||
5 | const expect = chai.expect | ||
6 | |||
7 | describe('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 | }) | ||