diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-08 11:49:38 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:17 +0200 |
commit | a2470c9f4bfc7f49f4b94de935bacdd53fd54f29 (patch) | |
tree | cb6b6b33d1a404fe31547c004241a7eb9743b64e /server/tests/api | |
parent | e3d15a6a9aed97a004d9dac1b7a6499d794e080a (diff) | |
download | PeerTube-a2470c9f4bfc7f49f4b94de935bacdd53fd54f29.tar.gz PeerTube-a2470c9f4bfc7f49f4b94de935bacdd53fd54f29.tar.zst PeerTube-a2470c9f4bfc7f49f4b94de935bacdd53fd54f29.zip |
Introduce captions command
Diffstat (limited to 'server/tests/api')
-rw-r--r-- | server/tests/api/check-params/video-captions.ts | 11 | ||||
-rw-r--r-- | server/tests/api/search/search-videos.ts | 9 | ||||
-rw-r--r-- | server/tests/api/server/follows.ts | 16 | ||||
-rw-r--r-- | server/tests/api/videos/video-captions.ts | 77 | ||||
-rw-r--r-- | server/tests/api/videos/video-imports.ts | 33 |
5 files changed, 60 insertions, 86 deletions
diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts index c0595c04d..baab0f276 100644 --- a/server/tests/api/check-params/video-captions.ts +++ b/server/tests/api/check-params/video-captions.ts | |||
@@ -1,8 +1,7 @@ | |||
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 { VideoCreateResult } from '@shared/models' | 4 | import { HttpStatusCode } from '@shared/core-utils' |
5 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
6 | import { | 5 | import { |
7 | buildAbsoluteFixturePath, | 6 | buildAbsoluteFixturePath, |
8 | cleanupTests, | 7 | cleanupTests, |
@@ -15,8 +14,8 @@ import { | |||
15 | setAccessTokensToServers, | 14 | setAccessTokensToServers, |
16 | uploadVideo, | 15 | uploadVideo, |
17 | userLogin | 16 | userLogin |
18 | } from '../../../../shared/extra-utils' | 17 | } from '@shared/extra-utils' |
19 | import { createVideoCaption } from '../../../../shared/extra-utils/videos/video-captions' | 18 | import { VideoCreateResult } from '@shared/models' |
20 | 19 | ||
21 | describe('Test video captions API validator', function () { | 20 | describe('Test video captions API validator', function () { |
22 | const path = '/api/v1/videos/' | 21 | const path = '/api/v1/videos/' |
@@ -159,9 +158,7 @@ describe('Test video captions API validator', function () { | |||
159 | // }) | 158 | // }) |
160 | 159 | ||
161 | it('Should succeed with a valid captionfile extension and octet-stream mime type', async function () { | 160 | it('Should succeed with a valid captionfile extension and octet-stream mime type', async function () { |
162 | await createVideoCaption({ | 161 | await server.captionsCommand.createVideoCaption({ |
163 | url: server.url, | ||
164 | accessToken: server.accessToken, | ||
165 | language: 'zh', | 162 | language: 'zh', |
166 | videoId: video.uuid, | 163 | videoId: video.uuid, |
167 | fixture: 'subtitle-good.srt', | 164 | fixture: 'subtitle-good.srt', |
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts index a0375fbf0..513538917 100644 --- a/server/tests/api/search/search-videos.ts +++ b/server/tests/api/search/search-videos.ts | |||
@@ -4,7 +4,6 @@ import 'mocha' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { | 5 | import { |
6 | cleanupTests, | 6 | cleanupTests, |
7 | createVideoCaption, | ||
8 | flushAndRunServer, | 7 | flushAndRunServer, |
9 | immutableAssign, | 8 | immutableAssign, |
10 | SearchCommand, | 9 | SearchCommand, |
@@ -54,18 +53,14 @@ describe('Test videos search', function () { | |||
54 | const videoId = res.body.video.id | 53 | const videoId = res.body.video.id |
55 | videoUUID = res.body.video.uuid | 54 | videoUUID = res.body.video.uuid |
56 | 55 | ||
57 | await createVideoCaption({ | 56 | await server.captionsCommand.createVideoCaption({ |
58 | url: server.url, | ||
59 | accessToken: server.accessToken, | ||
60 | language: 'en', | 57 | language: 'en', |
61 | videoId, | 58 | videoId, |
62 | fixture: 'subtitle-good2.vtt', | 59 | fixture: 'subtitle-good2.vtt', |
63 | mimeType: 'application/octet-stream' | 60 | mimeType: 'application/octet-stream' |
64 | }) | 61 | }) |
65 | 62 | ||
66 | await createVideoCaption({ | 63 | await server.captionsCommand.createVideoCaption({ |
67 | url: server.url, | ||
68 | accessToken: server.accessToken, | ||
69 | language: 'aa', | 64 | language: 'aa', |
70 | videoId, | 65 | videoId, |
71 | fixture: 'subtitle-good2.vtt', | 66 | fixture: 'subtitle-good2.vtt', |
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts index 466932d63..520442c6e 100644 --- a/server/tests/api/server/follows.ts +++ b/server/tests/api/server/follows.ts | |||
@@ -8,7 +8,6 @@ import { | |||
8 | cleanupTests, | 8 | cleanupTests, |
9 | completeVideoCheck, | 9 | completeVideoCheck, |
10 | createUser, | 10 | createUser, |
11 | createVideoCaption, | ||
12 | dateIsValid, | 11 | dateIsValid, |
13 | deleteVideoComment, | 12 | deleteVideoComment, |
14 | expectAccountFollows, | 13 | expectAccountFollows, |
@@ -17,7 +16,6 @@ import { | |||
17 | getVideoCommentThreads, | 16 | getVideoCommentThreads, |
18 | getVideosList, | 17 | getVideosList, |
19 | getVideoThreadComments, | 18 | getVideoThreadComments, |
20 | listVideoCaptions, | ||
21 | rateVideo, | 19 | rateVideo, |
22 | ServerInfo, | 20 | ServerInfo, |
23 | setAccessTokensToServers, | 21 | setAccessTokensToServers, |
@@ -26,7 +24,7 @@ import { | |||
26 | userLogin, | 24 | userLogin, |
27 | waitJobs | 25 | waitJobs |
28 | } from '@shared/extra-utils' | 26 | } from '@shared/extra-utils' |
29 | import { Video, VideoCaption, VideoComment, VideoCommentThreadTree, VideoPrivacy } from '@shared/models' | 27 | import { Video, VideoComment, VideoCommentThreadTree, VideoPrivacy } from '@shared/models' |
30 | 28 | ||
31 | const expect = chai.expect | 29 | const expect = chai.expect |
32 | 30 | ||
@@ -385,9 +383,7 @@ describe('Test follows', function () { | |||
385 | } | 383 | } |
386 | 384 | ||
387 | { | 385 | { |
388 | await createVideoCaption({ | 386 | await servers[2].captionsCommand.createVideoCaption({ |
389 | url: servers[2].url, | ||
390 | accessToken: servers[2].accessToken, | ||
391 | language: 'ar', | 387 | language: 'ar', |
392 | videoId: video4.id, | 388 | videoId: video4.id, |
393 | fixture: 'subtitle-good2.vtt' | 389 | fixture: 'subtitle-good2.vtt' |
@@ -543,11 +539,11 @@ describe('Test follows', function () { | |||
543 | }) | 539 | }) |
544 | 540 | ||
545 | it('Should have propagated captions', async function () { | 541 | it('Should have propagated captions', async function () { |
546 | const res = await listVideoCaptions(servers[0].url, video4.id) | 542 | const body = await servers[0].captionsCommand.listVideoCaptions({ videoId: video4.id }) |
547 | expect(res.body.total).to.equal(1) | 543 | expect(body.total).to.equal(1) |
548 | expect(res.body.data).to.have.lengthOf(1) | 544 | expect(body.data).to.have.lengthOf(1) |
549 | 545 | ||
550 | const caption1: VideoCaption = res.body.data[0] | 546 | const caption1 = body.data[0] |
551 | expect(caption1.language.id).to.equal('ar') | 547 | expect(caption1.language.id).to.equal('ar') |
552 | expect(caption1.language.label).to.equal('Arabic') | 548 | expect(caption1.language.label).to.equal('Arabic') |
553 | expect(caption1.captionPath).to.match(new RegExp('^/lazy-static/video-captions/.+-ar.vtt$')) | 549 | expect(caption1.captionPath).to.match(new RegExp('^/lazy-static/video-captions/.+-ar.vtt$')) |
diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts index 14ecedfa6..83ee809b8 100644 --- a/server/tests/api/videos/video-captions.ts +++ b/server/tests/api/videos/video-captions.ts | |||
@@ -1,25 +1,20 @@ | |||
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 * as chai from 'chai' | ||
4 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | ||
5 | import { | 5 | import { |
6 | checkVideoFilesWereRemoved, | 6 | checkVideoFilesWereRemoved, |
7 | cleanupTests, | 7 | cleanupTests, |
8 | doubleFollow, | 8 | doubleFollow, |
9 | flushAndRunMultipleServers, | 9 | flushAndRunMultipleServers, |
10 | removeVideo, | 10 | removeVideo, |
11 | ServerInfo, | ||
12 | setAccessTokensToServers, | ||
13 | testCaptionFile, | ||
11 | uploadVideo, | 14 | uploadVideo, |
12 | wait | 15 | wait, |
13 | } from '../../../../shared/extra-utils' | 16 | waitJobs |
14 | import { ServerInfo, setAccessTokensToServers } from '../../../../shared/extra-utils/index' | 17 | } from '@shared/extra-utils' |
15 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' | ||
16 | import { | ||
17 | createVideoCaption, | ||
18 | deleteVideoCaption, | ||
19 | listVideoCaptions, | ||
20 | testCaptionFile | ||
21 | } from '../../../../shared/extra-utils/videos/video-captions' | ||
22 | import { VideoCaption } from '../../../../shared/models/videos/caption/video-caption.model' | ||
23 | 18 | ||
24 | const expect = chai.expect | 19 | const expect = chai.expect |
25 | 20 | ||
@@ -47,26 +42,22 @@ describe('Test video captions', function () { | |||
47 | 42 | ||
48 | it('Should list the captions and return an empty list', async function () { | 43 | it('Should list the captions and return an empty list', async function () { |
49 | for (const server of servers) { | 44 | for (const server of servers) { |
50 | const res = await listVideoCaptions(server.url, videoUUID) | 45 | const body = await server.captionsCommand.listVideoCaptions({ videoId: videoUUID }) |
51 | expect(res.body.total).to.equal(0) | 46 | expect(body.total).to.equal(0) |
52 | expect(res.body.data).to.have.lengthOf(0) | 47 | expect(body.data).to.have.lengthOf(0) |
53 | } | 48 | } |
54 | }) | 49 | }) |
55 | 50 | ||
56 | it('Should create two new captions', async function () { | 51 | it('Should create two new captions', async function () { |
57 | this.timeout(30000) | 52 | this.timeout(30000) |
58 | 53 | ||
59 | await createVideoCaption({ | 54 | await servers[0].captionsCommand.createVideoCaption({ |
60 | url: servers[0].url, | ||
61 | accessToken: servers[0].accessToken, | ||
62 | language: 'ar', | 55 | language: 'ar', |
63 | videoId: videoUUID, | 56 | videoId: videoUUID, |
64 | fixture: 'subtitle-good1.vtt' | 57 | fixture: 'subtitle-good1.vtt' |
65 | }) | 58 | }) |
66 | 59 | ||
67 | await createVideoCaption({ | 60 | await servers[0].captionsCommand.createVideoCaption({ |
68 | url: servers[0].url, | ||
69 | accessToken: servers[0].accessToken, | ||
70 | language: 'zh', | 61 | language: 'zh', |
71 | videoId: videoUUID, | 62 | videoId: videoUUID, |
72 | fixture: 'subtitle-good2.vtt', | 63 | fixture: 'subtitle-good2.vtt', |
@@ -78,17 +69,17 @@ describe('Test video captions', function () { | |||
78 | 69 | ||
79 | it('Should list these uploaded captions', async function () { | 70 | it('Should list these uploaded captions', async function () { |
80 | for (const server of servers) { | 71 | for (const server of servers) { |
81 | const res = await listVideoCaptions(server.url, videoUUID) | 72 | const body = await server.captionsCommand.listVideoCaptions({ videoId: videoUUID }) |
82 | expect(res.body.total).to.equal(2) | 73 | expect(body.total).to.equal(2) |
83 | expect(res.body.data).to.have.lengthOf(2) | 74 | expect(body.data).to.have.lengthOf(2) |
84 | 75 | ||
85 | const caption1: VideoCaption = res.body.data[0] | 76 | const caption1 = body.data[0] |
86 | expect(caption1.language.id).to.equal('ar') | 77 | expect(caption1.language.id).to.equal('ar') |
87 | expect(caption1.language.label).to.equal('Arabic') | 78 | expect(caption1.language.label).to.equal('Arabic') |
88 | expect(caption1.captionPath).to.match(new RegExp('^/lazy-static/video-captions/' + uuidRegex + '-ar.vtt$')) | 79 | expect(caption1.captionPath).to.match(new RegExp('^/lazy-static/video-captions/' + uuidRegex + '-ar.vtt$')) |
89 | await testCaptionFile(server.url, caption1.captionPath, 'Subtitle good 1.') | 80 | await testCaptionFile(server.url, caption1.captionPath, 'Subtitle good 1.') |
90 | 81 | ||
91 | const caption2: VideoCaption = res.body.data[1] | 82 | const caption2 = body.data[1] |
92 | expect(caption2.language.id).to.equal('zh') | 83 | expect(caption2.language.id).to.equal('zh') |
93 | expect(caption2.language.label).to.equal('Chinese') | 84 | expect(caption2.language.label).to.equal('Chinese') |
94 | expect(caption2.captionPath).to.match(new RegExp('^/lazy-static/video-captions/' + uuidRegex + '-zh.vtt$')) | 85 | expect(caption2.captionPath).to.match(new RegExp('^/lazy-static/video-captions/' + uuidRegex + '-zh.vtt$')) |
@@ -99,9 +90,7 @@ describe('Test video captions', function () { | |||
99 | it('Should replace an existing caption', async function () { | 90 | it('Should replace an existing caption', async function () { |
100 | this.timeout(30000) | 91 | this.timeout(30000) |
101 | 92 | ||
102 | await createVideoCaption({ | 93 | await servers[0].captionsCommand.createVideoCaption({ |
103 | url: servers[0].url, | ||
104 | accessToken: servers[0].accessToken, | ||
105 | language: 'ar', | 94 | language: 'ar', |
106 | videoId: videoUUID, | 95 | videoId: videoUUID, |
107 | fixture: 'subtitle-good2.vtt' | 96 | fixture: 'subtitle-good2.vtt' |
@@ -112,11 +101,11 @@ describe('Test video captions', function () { | |||
112 | 101 | ||
113 | it('Should have this caption updated', async function () { | 102 | it('Should have this caption updated', async function () { |
114 | for (const server of servers) { | 103 | for (const server of servers) { |
115 | const res = await listVideoCaptions(server.url, videoUUID) | 104 | const body = await server.captionsCommand.listVideoCaptions({ videoId: videoUUID }) |
116 | expect(res.body.total).to.equal(2) | 105 | expect(body.total).to.equal(2) |
117 | expect(res.body.data).to.have.lengthOf(2) | 106 | expect(body.data).to.have.lengthOf(2) |
118 | 107 | ||
119 | const caption1: VideoCaption = res.body.data[0] | 108 | const caption1 = body.data[0] |
120 | expect(caption1.language.id).to.equal('ar') | 109 | expect(caption1.language.id).to.equal('ar') |
121 | expect(caption1.language.label).to.equal('Arabic') | 110 | expect(caption1.language.label).to.equal('Arabic') |
122 | expect(caption1.captionPath).to.match(new RegExp('^/lazy-static/video-captions/' + uuidRegex + '-ar.vtt$')) | 111 | expect(caption1.captionPath).to.match(new RegExp('^/lazy-static/video-captions/' + uuidRegex + '-ar.vtt$')) |
@@ -127,9 +116,7 @@ describe('Test video captions', function () { | |||
127 | it('Should replace an existing caption with a srt file and convert it', async function () { | 116 | it('Should replace an existing caption with a srt file and convert it', async function () { |
128 | this.timeout(30000) | 117 | this.timeout(30000) |
129 | 118 | ||
130 | await createVideoCaption({ | 119 | await servers[0].captionsCommand.createVideoCaption({ |
131 | url: servers[0].url, | ||
132 | accessToken: servers[0].accessToken, | ||
133 | language: 'ar', | 120 | language: 'ar', |
134 | videoId: videoUUID, | 121 | videoId: videoUUID, |
135 | fixture: 'subtitle-good.srt' | 122 | fixture: 'subtitle-good.srt' |
@@ -143,11 +130,11 @@ describe('Test video captions', function () { | |||
143 | 130 | ||
144 | it('Should have this caption updated and converted', async function () { | 131 | it('Should have this caption updated and converted', async function () { |
145 | for (const server of servers) { | 132 | for (const server of servers) { |
146 | const res = await listVideoCaptions(server.url, videoUUID) | 133 | const body = await server.captionsCommand.listVideoCaptions({ videoId: videoUUID }) |
147 | expect(res.body.total).to.equal(2) | 134 | expect(body.total).to.equal(2) |
148 | expect(res.body.data).to.have.lengthOf(2) | 135 | expect(body.data).to.have.lengthOf(2) |
149 | 136 | ||
150 | const caption1: VideoCaption = res.body.data[0] | 137 | const caption1 = body.data[0] |
151 | expect(caption1.language.id).to.equal('ar') | 138 | expect(caption1.language.id).to.equal('ar') |
152 | expect(caption1.language.label).to.equal('Arabic') | 139 | expect(caption1.language.label).to.equal('Arabic') |
153 | expect(caption1.captionPath).to.match(new RegExp('^/lazy-static/video-captions/' + uuidRegex + '-ar.vtt$')) | 140 | expect(caption1.captionPath).to.match(new RegExp('^/lazy-static/video-captions/' + uuidRegex + '-ar.vtt$')) |
@@ -172,18 +159,18 @@ describe('Test video captions', function () { | |||
172 | it('Should remove one caption', async function () { | 159 | it('Should remove one caption', async function () { |
173 | this.timeout(30000) | 160 | this.timeout(30000) |
174 | 161 | ||
175 | await deleteVideoCaption(servers[0].url, servers[0].accessToken, videoUUID, 'ar') | 162 | await servers[0].captionsCommand.deleteVideoCaption({ videoId: videoUUID, language: 'ar' }) |
176 | 163 | ||
177 | await waitJobs(servers) | 164 | await waitJobs(servers) |
178 | }) | 165 | }) |
179 | 166 | ||
180 | it('Should only list the caption that was not deleted', async function () { | 167 | it('Should only list the caption that was not deleted', async function () { |
181 | for (const server of servers) { | 168 | for (const server of servers) { |
182 | const res = await listVideoCaptions(server.url, videoUUID) | 169 | const body = await server.captionsCommand.listVideoCaptions({ videoId: videoUUID }) |
183 | expect(res.body.total).to.equal(1) | 170 | expect(body.total).to.equal(1) |
184 | expect(res.body.data).to.have.lengthOf(1) | 171 | expect(body.data).to.have.lengthOf(1) |
185 | 172 | ||
186 | const caption: VideoCaption = res.body.data[0] | 173 | const caption = body.data[0] |
187 | 174 | ||
188 | expect(caption.language.id).to.equal('zh') | 175 | expect(caption.language.id).to.equal('zh') |
189 | expect(caption.language.label).to.equal('Chinese') | 176 | expect(caption.language.label).to.equal('Chinese') |
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts index a4a9132b4..14aed604f 100644 --- a/server/tests/api/videos/video-imports.ts +++ b/server/tests/api/videos/video-imports.ts | |||
@@ -11,7 +11,6 @@ import { | |||
11 | getVideo, | 11 | getVideo, |
12 | getVideosList, | 12 | getVideosList, |
13 | immutableAssign, | 13 | immutableAssign, |
14 | listVideoCaptions, | ||
15 | ServerInfo, | 14 | ServerInfo, |
16 | setAccessTokensToServers, | 15 | setAccessTokensToServers, |
17 | testCaptionFile | 16 | testCaptionFile |
@@ -25,7 +24,7 @@ import { | |||
25 | getYoutubeVideoUrl, | 24 | getYoutubeVideoUrl, |
26 | importVideo | 25 | importVideo |
27 | } from '../../../../shared/extra-utils/videos/video-imports' | 26 | } from '../../../../shared/extra-utils/videos/video-imports' |
28 | import { VideoCaption, VideoDetails, VideoImport, VideoPrivacy, VideoResolution } from '../../../../shared/models/videos' | 27 | import { VideoDetails, VideoImport, VideoPrivacy, VideoResolution } from '../../../../shared/models/videos' |
29 | 28 | ||
30 | const expect = chai.expect | 29 | const expect = chai.expect |
31 | 30 | ||
@@ -36,8 +35,8 @@ describe('Test video imports', function () { | |||
36 | 35 | ||
37 | if (areHttpImportTestsDisabled()) return | 36 | if (areHttpImportTestsDisabled()) return |
38 | 37 | ||
39 | async function checkVideosServer1 (url: string, idHttp: string, idMagnet: string, idTorrent: string) { | 38 | async function checkVideosServer1 (server: ServerInfo, idHttp: string, idMagnet: string, idTorrent: string) { |
40 | const resHttp = await getVideo(url, idHttp) | 39 | const resHttp = await getVideo(server.url, idHttp) |
41 | const videoHttp: VideoDetails = resHttp.body | 40 | const videoHttp: VideoDetails = resHttp.body |
42 | 41 | ||
43 | expect(videoHttp.name).to.equal('small video - youtube') | 42 | expect(videoHttp.name).to.equal('small video - youtube') |
@@ -55,9 +54,9 @@ describe('Test video imports', function () { | |||
55 | expect(originallyPublishedAt.getMonth()).to.equal(0) | 54 | expect(originallyPublishedAt.getMonth()).to.equal(0) |
56 | expect(originallyPublishedAt.getFullYear()).to.equal(2019) | 55 | expect(originallyPublishedAt.getFullYear()).to.equal(2019) |
57 | 56 | ||
58 | const resMagnet = await getVideo(url, idMagnet) | 57 | const resMagnet = await getVideo(server.url, idMagnet) |
59 | const videoMagnet: VideoDetails = resMagnet.body | 58 | const videoMagnet: VideoDetails = resMagnet.body |
60 | const resTorrent = await getVideo(url, idTorrent) | 59 | const resTorrent = await getVideo(server.url, idTorrent) |
61 | const videoTorrent: VideoDetails = resTorrent.body | 60 | const videoTorrent: VideoDetails = resTorrent.body |
62 | 61 | ||
63 | for (const video of [ videoMagnet, videoTorrent ]) { | 62 | for (const video of [ videoMagnet, videoTorrent ]) { |
@@ -73,12 +72,12 @@ describe('Test video imports', function () { | |||
73 | expect(videoTorrent.name).to.contain('你好 世界 720p.mp4') | 72 | expect(videoTorrent.name).to.contain('你好 世界 720p.mp4') |
74 | expect(videoMagnet.name).to.contain('super peertube2 video') | 73 | expect(videoMagnet.name).to.contain('super peertube2 video') |
75 | 74 | ||
76 | const resCaptions = await listVideoCaptions(url, idHttp) | 75 | const bodyCaptions = await server.captionsCommand.listVideoCaptions({ videoId: idHttp }) |
77 | expect(resCaptions.body.total).to.equal(2) | 76 | expect(bodyCaptions.total).to.equal(2) |
78 | } | 77 | } |
79 | 78 | ||
80 | async function checkVideoServer2 (url: string, id: number | string) { | 79 | async function checkVideoServer2 (server: ServerInfo, id: number | string) { |
81 | const res = await getVideo(url, id) | 80 | const res = await getVideo(server.url, id) |
82 | const video: VideoDetails = res.body | 81 | const video: VideoDetails = res.body |
83 | 82 | ||
84 | expect(video.name).to.equal('my super name') | 83 | expect(video.name).to.equal('my super name') |
@@ -91,8 +90,8 @@ describe('Test video imports', function () { | |||
91 | 90 | ||
92 | expect(video.files).to.have.lengthOf(1) | 91 | expect(video.files).to.have.lengthOf(1) |
93 | 92 | ||
94 | const resCaptions = await listVideoCaptions(url, id) | 93 | const bodyCaptions = await server.captionsCommand.listVideoCaptions({ videoId: id }) |
95 | expect(resCaptions.body.total).to.equal(2) | 94 | expect(bodyCaptions.total).to.equal(2) |
96 | } | 95 | } |
97 | 96 | ||
98 | before(async function () { | 97 | before(async function () { |
@@ -135,8 +134,8 @@ describe('Test video imports', function () { | |||
135 | await testImage(servers[0].url, 'video_import_thumbnail', res.body.video.thumbnailPath) | 134 | await testImage(servers[0].url, 'video_import_thumbnail', res.body.video.thumbnailPath) |
136 | await testImage(servers[0].url, 'video_import_preview', res.body.video.previewPath) | 135 | await testImage(servers[0].url, 'video_import_preview', res.body.video.previewPath) |
137 | 136 | ||
138 | const resCaptions = await listVideoCaptions(servers[0].url, res.body.video.id) | 137 | const bodyCaptions = await servers[0].captionsCommand.listVideoCaptions({ videoId: res.body.video.id }) |
139 | const videoCaptions: VideoCaption[] = resCaptions.body.data | 138 | const videoCaptions = bodyCaptions.data |
140 | expect(videoCaptions).to.have.lengthOf(2) | 139 | expect(videoCaptions).to.have.lengthOf(2) |
141 | 140 | ||
142 | const enCaption = videoCaptions.find(caption => caption.language.id === 'en') | 141 | const enCaption = videoCaptions.find(caption => caption.language.id === 'en') |
@@ -241,7 +240,7 @@ Ajouter un sous-titre est vraiment facile`) | |||
241 | expect(res.body.data).to.have.lengthOf(3) | 240 | expect(res.body.data).to.have.lengthOf(3) |
242 | 241 | ||
243 | const [ videoHttp, videoMagnet, videoTorrent ] = res.body.data | 242 | const [ videoHttp, videoMagnet, videoTorrent ] = res.body.data |
244 | await checkVideosServer1(server.url, videoHttp.uuid, videoMagnet.uuid, videoTorrent.uuid) | 243 | await checkVideosServer1(server, videoHttp.uuid, videoMagnet.uuid, videoTorrent.uuid) |
245 | } | 244 | } |
246 | }) | 245 | }) |
247 | 246 | ||
@@ -273,10 +272,10 @@ Ajouter un sous-titre est vraiment facile`) | |||
273 | expect(res.body.total).to.equal(4) | 272 | expect(res.body.total).to.equal(4) |
274 | expect(res.body.data).to.have.lengthOf(4) | 273 | expect(res.body.data).to.have.lengthOf(4) |
275 | 274 | ||
276 | await checkVideoServer2(server.url, res.body.data[0].uuid) | 275 | await checkVideoServer2(server, res.body.data[0].uuid) |
277 | 276 | ||
278 | const [ , videoHttp, videoMagnet, videoTorrent ] = res.body.data | 277 | const [ , videoHttp, videoMagnet, videoTorrent ] = res.body.data |
279 | await checkVideosServer1(server.url, videoHttp.uuid, videoMagnet.uuid, videoTorrent.uuid) | 278 | await checkVideosServer1(server, videoHttp.uuid, videoMagnet.uuid, videoTorrent.uuid) |
280 | } | 279 | } |
281 | }) | 280 | }) |
282 | 281 | ||