diff options
author | Chocobozzz <me@florianbigard.com> | 2021-11-17 16:04:53 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-11-18 09:04:30 +0100 |
commit | b46cf4b920984492df598c1b61179acfc7f6f22e (patch) | |
tree | 21fda049c85be48ab3d37b537aafa98e94649ad7 /server/tests/api/videos | |
parent | 3cfa817672657df18260ece5b354efa0f3b6e317 (diff) | |
download | PeerTube-b46cf4b920984492df598c1b61179acfc7f6f22e.tar.gz PeerTube-b46cf4b920984492df598c1b61179acfc7f6f22e.tar.zst PeerTube-b46cf4b920984492df598c1b61179acfc7f6f22e.zip |
Add ability to remove hls/webtorrent files
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-files.ts | 70 |
2 files changed, 71 insertions, 0 deletions
diff --git a/server/tests/api/videos/index.ts b/server/tests/api/videos/index.ts index c9c678e9d..f92e339e7 100644 --- a/server/tests/api/videos/index.ts +++ b/server/tests/api/videos/index.ts | |||
@@ -7,6 +7,7 @@ import './video-change-ownership' | |||
7 | import './video-channels' | 7 | import './video-channels' |
8 | import './video-comments' | 8 | import './video-comments' |
9 | import './video-description' | 9 | import './video-description' |
10 | import './video-files' | ||
10 | import './video-hls' | 11 | import './video-hls' |
11 | import './video-imports' | 12 | import './video-imports' |
12 | import './video-nsfw' | 13 | import './video-nsfw' |
diff --git a/server/tests/api/videos/video-files.ts b/server/tests/api/videos/video-files.ts new file mode 100644 index 000000000..fcb2ca2e4 --- /dev/null +++ b/server/tests/api/videos/video-files.ts | |||
@@ -0,0 +1,70 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | ||
2 | |||
3 | import 'mocha' | ||
4 | import { expect } from 'chai' | ||
5 | import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | ||
6 | |||
7 | describe('Test videos files', function () { | ||
8 | let servers: PeerTubeServer[] | ||
9 | let validId1: string | ||
10 | let validId2: string | ||
11 | |||
12 | // --------------------------------------------------------------- | ||
13 | |||
14 | before(async function () { | ||
15 | this.timeout(150_000) | ||
16 | |||
17 | servers = await createMultipleServers(2) | ||
18 | await setAccessTokensToServers(servers) | ||
19 | |||
20 | await doubleFollow(servers[0], servers[1]) | ||
21 | |||
22 | await servers[0].config.enableTranscoding(true, true) | ||
23 | |||
24 | { | ||
25 | const { uuid } = await servers[0].videos.quickUpload({ name: 'video 1' }) | ||
26 | validId1 = uuid | ||
27 | } | ||
28 | |||
29 | { | ||
30 | const { uuid } = await servers[0].videos.quickUpload({ name: 'video 2' }) | ||
31 | validId2 = uuid | ||
32 | } | ||
33 | |||
34 | await waitJobs(servers) | ||
35 | }) | ||
36 | |||
37 | it('Should delete webtorrent files', async function () { | ||
38 | this.timeout(30_000) | ||
39 | |||
40 | await servers[0].videos.removeWebTorrentFiles({ videoId: validId1 }) | ||
41 | |||
42 | await waitJobs(servers) | ||
43 | |||
44 | for (const server of servers) { | ||
45 | const video = await server.videos.get({ id: validId1 }) | ||
46 | |||
47 | expect(video.files).to.have.lengthOf(0) | ||
48 | expect(video.streamingPlaylists).to.have.lengthOf(1) | ||
49 | } | ||
50 | }) | ||
51 | |||
52 | it('Should delete HLS files', async function () { | ||
53 | this.timeout(30_000) | ||
54 | |||
55 | await servers[0].videos.removeHLSFiles({ videoId: validId2 }) | ||
56 | |||
57 | await waitJobs(servers) | ||
58 | |||
59 | for (const server of servers) { | ||
60 | const video = await server.videos.get({ id: validId2 }) | ||
61 | |||
62 | expect(video.files).to.have.length.above(0) | ||
63 | expect(video.streamingPlaylists).to.have.lengthOf(0) | ||
64 | } | ||
65 | }) | ||
66 | |||
67 | after(async function () { | ||
68 | await cleanupTests(servers) | ||
69 | }) | ||
70 | }) | ||