diff options
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r-- | server/tests/api/videos/index.ts | 1 | ||||
-rw-r--r-- | server/tests/api/videos/video-source.ts | 39 |
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' | |||
16 | import './videos-common-filters' | 16 | import './videos-common-filters' |
17 | import './videos-history' | 17 | import './videos-history' |
18 | import './videos-overview' | 18 | import './videos-overview' |
19 | 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 @@ | |||
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 | }) | ||