diff options
Diffstat (limited to 'server/tests/api/check-params/video-files.ts')
-rw-r--r-- | server/tests/api/check-params/video-files.ts | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/server/tests/api/check-params/video-files.ts b/server/tests/api/check-params/video-files.ts index 48b10d2b5..61936d562 100644 --- a/server/tests/api/check-params/video-files.ts +++ b/server/tests/api/check-params/video-files.ts | |||
@@ -1,16 +1,19 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { cleanupTests, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' | 4 | import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' |
5 | import { HttpStatusCode, UserRole } from '@shared/models' | 5 | import { HttpStatusCode, UserRole } from '@shared/models' |
6 | 6 | ||
7 | describe('Test videos files', function () { | 7 | describe('Test videos files', function () { |
8 | let servers: PeerTubeServer[] | 8 | let servers: PeerTubeServer[] |
9 | |||
9 | let webtorrentId: string | 10 | let webtorrentId: string |
10 | let hlsId: string | 11 | let hlsId: string |
11 | let remoteId: string | 12 | let remoteId: string |
13 | |||
12 | let userToken: string | 14 | let userToken: string |
13 | let moderatorToken: string | 15 | let moderatorToken: string |
16 | |||
14 | let validId1: string | 17 | let validId1: string |
15 | let validId2: string | 18 | let validId2: string |
16 | 19 | ||
@@ -22,10 +25,17 @@ describe('Test videos files', function () { | |||
22 | servers = await createMultipleServers(2) | 25 | servers = await createMultipleServers(2) |
23 | await setAccessTokensToServers(servers) | 26 | await setAccessTokensToServers(servers) |
24 | 27 | ||
28 | await doubleFollow(servers[0], servers[1]) | ||
29 | |||
25 | userToken = await servers[0].users.generateUserAndToken('user', UserRole.USER) | 30 | userToken = await servers[0].users.generateUserAndToken('user', UserRole.USER) |
26 | moderatorToken = await servers[0].users.generateUserAndToken('moderator', UserRole.MODERATOR) | 31 | moderatorToken = await servers[0].users.generateUserAndToken('moderator', UserRole.MODERATOR) |
27 | 32 | ||
28 | { | 33 | { |
34 | const { uuid } = await servers[1].videos.quickUpload({ name: 'remote video' }) | ||
35 | remoteId = uuid | ||
36 | } | ||
37 | |||
38 | { | ||
29 | await servers[0].config.enableTranscoding(true, true) | 39 | await servers[0].config.enableTranscoding(true, true) |
30 | 40 | ||
31 | { | 41 | { |
@@ -58,6 +68,11 @@ describe('Test videos files', function () { | |||
58 | await waitJobs(servers) | 68 | await waitJobs(servers) |
59 | }) | 69 | }) |
60 | 70 | ||
71 | it('Should not delete files of a unknown video', async function () { | ||
72 | await servers[0].videos.removeHLSFiles({ videoId: 404, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | ||
73 | await servers[0].videos.removeWebTorrentFiles({ videoId: 404, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | ||
74 | }) | ||
75 | |||
61 | it('Should not delete files of a remote video', async function () { | 76 | it('Should not delete files of a remote video', async function () { |
62 | await servers[0].videos.removeHLSFiles({ videoId: remoteId, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 77 | await servers[0].videos.removeHLSFiles({ videoId: remoteId, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
63 | await servers[0].videos.removeWebTorrentFiles({ videoId: remoteId, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 78 | await servers[0].videos.removeWebTorrentFiles({ videoId: remoteId, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |