]>
Commit | Line | Data |
---|---|---|
a1587156 | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
9b474844 | 2 | |
9b474844 | 3 | import 'mocha' |
2158ac90 | 4 | import * as chai from 'chai' |
af971e06 | 5 | import { HttpStatusCode } from '@shared/core-utils' |
89cd1275 C |
6 | import { |
7 | addVideoCommentReply, | |
6691c522 | 8 | addVideoCommentThread, |
af971e06 | 9 | cleanupTests, |
eebd9838 | 10 | createVideoPlaylist, |
a1587156 | 11 | doubleFollow, |
af971e06 | 12 | flushAndRunMultipleServers, |
38267c0c | 13 | getAccountVideos, |
a4d2ca07 | 14 | getMyVideos, |
6691c522 | 15 | getVideo, |
38267c0c | 16 | getVideoChannelVideos, |
6691c522 | 17 | getVideoCommentThreads, |
eebd9838 | 18 | getVideoPlaylist, |
a1587156 C |
19 | getVideosList, |
20 | getVideosListPagination, | |
6691c522 C |
21 | getVideoThreadComments, |
22 | getVideoWithToken, | |
4bc45da3 | 23 | makeRawRequest, |
ae2abfd3 | 24 | PluginsCommand, |
a1587156 | 25 | registerUser, |
af971e06 | 26 | ServerInfo, |
a1587156 | 27 | setAccessTokensToServers, |
6691c522 | 28 | setDefaultVideoChannel, |
a1587156 C |
29 | updateVideo, |
30 | uploadVideo, | |
4bc45da3 | 31 | uploadVideoAndGetId, |
af971e06 C |
32 | waitJobs, |
33 | waitUntilLog | |
34 | } from '@shared/extra-utils' | |
35 | import { getGoodVideoUrl, getMyVideoImports, importVideo } from '@shared/extra-utils/videos/video-imports' | |
eebd9838 | 36 | import { |
2b02c520 | 37 | VideoCommentThreadTree, |
eebd9838 C |
38 | VideoDetails, |
39 | VideoImport, | |
40 | VideoImportState, | |
41 | VideoPlaylist, | |
42 | VideoPlaylistPrivacy, | |
43 | VideoPrivacy | |
af971e06 | 44 | } from '@shared/models' |
9b474844 C |
45 | |
46 | const expect = chai.expect | |
47 | ||
48 | describe('Test plugin filter hooks', function () { | |
89cd1275 C |
49 | let servers: ServerInfo[] |
50 | let videoUUID: string | |
51 | let threadId: number | |
9b474844 C |
52 | |
53 | before(async function () { | |
4076e2ef | 54 | this.timeout(60000) |
9b474844 | 55 | |
89cd1275 C |
56 | servers = await flushAndRunMultipleServers(2) |
57 | await setAccessTokensToServers(servers) | |
6691c522 C |
58 | await setDefaultVideoChannel(servers) |
59 | await doubleFollow(servers[0], servers[1]) | |
89cd1275 | 60 | |
ae2abfd3 C |
61 | await servers[0].pluginsCommand.install({ path: PluginsCommand.getPluginTestPath() }) |
62 | await servers[0].pluginsCommand.install({ path: PluginsCommand.getPluginTestPath('-filter-translations') }) | |
89cd1275 C |
63 | |
64 | for (let i = 0; i < 10; i++) { | |
65 | await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'default video ' + i }) | |
66 | } | |
67 | ||
68 | const res = await getVideosList(servers[0].url) | |
69 | videoUUID = res.body.data[0].uuid | |
3cabf353 | 70 | |
65e6e260 C |
71 | await servers[0].configCommand.updateCustomSubConfig({ |
72 | newConfig: { | |
73 | live: { enabled: true }, | |
74 | signup: { enabled: true }, | |
75 | import: { | |
76 | videos: { | |
77 | http: { enabled: true }, | |
78 | torrent: { enabled: true } | |
79 | } | |
3cabf353 C |
80 | } |
81 | } | |
82 | }) | |
9b474844 C |
83 | }) |
84 | ||
6691c522 | 85 | it('Should run filter:api.videos.list.params', async function () { |
89cd1275 C |
86 | const res = await getVideosListPagination(servers[0].url, 0, 2) |
87 | ||
88 | // 2 plugins do +1 to the count parameter | |
89 | expect(res.body.data).to.have.lengthOf(4) | |
90 | }) | |
91 | ||
92 | it('Should run filter:api.videos.list.result', async function () { | |
93 | const res = await getVideosListPagination(servers[0].url, 0, 0) | |
94 | ||
95 | // Plugin do +1 to the total result | |
96 | expect(res.body.total).to.equal(11) | |
97 | }) | |
98 | ||
38267c0c C |
99 | it('Should run filter:api.accounts.videos.list.params', async function () { |
100 | const res = await getAccountVideos(servers[0].url, servers[0].accessToken, 'root', 0, 2) | |
101 | ||
102 | // 1 plugin do +1 to the count parameter | |
103 | expect(res.body.data).to.have.lengthOf(3) | |
104 | }) | |
105 | ||
106 | it('Should run filter:api.accounts.videos.list.result', async function () { | |
107 | const res = await getAccountVideos(servers[0].url, servers[0].accessToken, 'root', 0, 2) | |
108 | ||
109 | // Plugin do +2 to the total result | |
110 | expect(res.body.total).to.equal(12) | |
111 | }) | |
112 | ||
113 | it('Should run filter:api.video-channels.videos.list.params', async function () { | |
114 | const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, 'root_channel', 0, 2) | |
115 | ||
116 | // 1 plugin do +3 to the count parameter | |
117 | expect(res.body.data).to.have.lengthOf(5) | |
118 | }) | |
119 | ||
120 | it('Should run filter:api.video-channels.videos.list.result', async function () { | |
c824e8a0 | 121 | const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, 'root_channel', 0, 2) |
38267c0c C |
122 | |
123 | // Plugin do +3 to the total result | |
124 | expect(res.body.total).to.equal(13) | |
125 | }) | |
126 | ||
a4d2ca07 C |
127 | it('Should run filter:api.user.me.videos.list.params', async function () { |
128 | const res = await getMyVideos(servers[0].url, servers[0].accessToken, 0, 2) | |
129 | ||
130 | // 1 plugin do +4 to the count parameter | |
131 | expect(res.body.data).to.have.lengthOf(6) | |
132 | }) | |
133 | ||
134 | it('Should run filter:api.user.me.videos.list.result', async function () { | |
135 | const res = await getMyVideos(servers[0].url, servers[0].accessToken, 0, 2) | |
136 | ||
137 | // Plugin do +4 to the total result | |
138 | expect(res.body.total).to.equal(14) | |
139 | }) | |
140 | ||
89cd1275 C |
141 | it('Should run filter:api.video.get.result', async function () { |
142 | const res = await getVideo(servers[0].url, videoUUID) | |
143 | ||
144 | expect(res.body.name).to.contain('<3') | |
9b474844 C |
145 | }) |
146 | ||
6691c522 | 147 | it('Should run filter:api.video.upload.accept.result', async function () { |
f2eb23cd | 148 | await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video with bad word' }, HttpStatusCode.FORBIDDEN_403) |
6691c522 C |
149 | }) |
150 | ||
3cabf353 C |
151 | it('Should run filter:api.live-video.create.accept.result', async function () { |
152 | const attributes = { | |
153 | name: 'video with bad word', | |
154 | privacy: VideoPrivacy.PUBLIC, | |
155 | channelId: servers[0].videoChannel.id | |
156 | } | |
157 | ||
4f219914 | 158 | await servers[0].liveCommand.createLive({ fields: attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
3cabf353 C |
159 | }) |
160 | ||
2158ac90 RK |
161 | it('Should run filter:api.video.pre-import-url.accept.result', async function () { |
162 | const baseAttributes = { | |
163 | name: 'normal title', | |
164 | privacy: VideoPrivacy.PUBLIC, | |
165 | channelId: servers[0].videoChannel.id, | |
b488ba1e | 166 | targetUrl: getGoodVideoUrl() + 'bad' |
2158ac90 | 167 | } |
f2eb23cd | 168 | await importVideo(servers[0].url, servers[0].accessToken, baseAttributes, HttpStatusCode.FORBIDDEN_403) |
2158ac90 RK |
169 | }) |
170 | ||
171 | it('Should run filter:api.video.pre-import-torrent.accept.result', async function () { | |
172 | const baseAttributes = { | |
173 | name: 'bad torrent', | |
174 | privacy: VideoPrivacy.PUBLIC, | |
175 | channelId: servers[0].videoChannel.id, | |
176 | torrentfile: 'video-720p.torrent' as any | |
177 | } | |
f2eb23cd | 178 | await importVideo(servers[0].url, servers[0].accessToken, baseAttributes, HttpStatusCode.FORBIDDEN_403) |
2158ac90 RK |
179 | }) |
180 | ||
181 | it('Should run filter:api.video.post-import-url.accept.result', async function () { | |
182 | this.timeout(60000) | |
183 | ||
184 | let videoImportId: number | |
185 | ||
186 | { | |
187 | const baseAttributes = { | |
188 | name: 'title with bad word', | |
189 | privacy: VideoPrivacy.PUBLIC, | |
190 | channelId: servers[0].videoChannel.id, | |
b488ba1e | 191 | targetUrl: getGoodVideoUrl() |
2158ac90 RK |
192 | } |
193 | const res = await importVideo(servers[0].url, servers[0].accessToken, baseAttributes) | |
194 | videoImportId = res.body.id | |
195 | } | |
196 | ||
197 | await waitJobs(servers) | |
198 | ||
199 | { | |
200 | const res = await getMyVideoImports(servers[0].url, servers[0].accessToken) | |
201 | const videoImports = res.body.data as VideoImport[] | |
202 | ||
203 | const videoImport = videoImports.find(i => i.id === videoImportId) | |
204 | ||
205 | expect(videoImport.state.id).to.equal(VideoImportState.REJECTED) | |
206 | expect(videoImport.state.label).to.equal('Rejected') | |
207 | } | |
208 | }) | |
209 | ||
210 | it('Should run filter:api.video.post-import-torrent.accept.result', async function () { | |
211 | this.timeout(60000) | |
212 | ||
213 | let videoImportId: number | |
214 | ||
215 | { | |
216 | const baseAttributes = { | |
217 | name: 'title with bad word', | |
218 | privacy: VideoPrivacy.PUBLIC, | |
219 | channelId: servers[0].videoChannel.id, | |
220 | torrentfile: 'video-720p.torrent' as any | |
221 | } | |
222 | const res = await importVideo(servers[0].url, servers[0].accessToken, baseAttributes) | |
223 | videoImportId = res.body.id | |
224 | } | |
225 | ||
226 | await waitJobs(servers) | |
227 | ||
228 | { | |
229 | const res = await getMyVideoImports(servers[0].url, servers[0].accessToken) | |
230 | const videoImports = res.body.data as VideoImport[] | |
231 | ||
232 | const videoImport = videoImports.find(i => i.id === videoImportId) | |
233 | ||
234 | expect(videoImport.state.id).to.equal(VideoImportState.REJECTED) | |
235 | expect(videoImport.state.label).to.equal('Rejected') | |
236 | } | |
237 | }) | |
238 | ||
6691c522 | 239 | it('Should run filter:api.video-thread.create.accept.result', async function () { |
f2eb23cd | 240 | await addVideoCommentThread(servers[0].url, servers[0].accessToken, videoUUID, 'comment with bad word', HttpStatusCode.FORBIDDEN_403) |
6691c522 C |
241 | }) |
242 | ||
243 | it('Should run filter:api.video-comment-reply.create.accept.result', async function () { | |
244 | const res = await addVideoCommentThread(servers[0].url, servers[0].accessToken, videoUUID, 'thread') | |
245 | threadId = res.body.comment.id | |
246 | ||
f2eb23cd RK |
247 | await addVideoCommentReply( |
248 | servers[0].url, | |
249 | servers[0].accessToken, | |
250 | videoUUID, | |
251 | threadId, | |
252 | 'comment with bad word', | |
253 | HttpStatusCode.FORBIDDEN_403 | |
254 | ) | |
255 | await addVideoCommentReply(servers[0].url, servers[0].accessToken, videoUUID, threadId, 'comment with good word', HttpStatusCode.OK_200) | |
6691c522 C |
256 | }) |
257 | ||
258 | it('Should run filter:api.video-threads.list.params', async function () { | |
259 | const res = await getVideoCommentThreads(servers[0].url, videoUUID, 0, 0) | |
260 | ||
261 | // our plugin do +1 to the count parameter | |
262 | expect(res.body.data).to.have.lengthOf(1) | |
263 | }) | |
264 | ||
265 | it('Should run filter:api.video-threads.list.result', async function () { | |
266 | const res = await getVideoCommentThreads(servers[0].url, videoUUID, 0, 0) | |
267 | ||
268 | // Plugin do +1 to the total result | |
269 | expect(res.body.total).to.equal(2) | |
270 | }) | |
271 | ||
272 | it('Should run filter:api.video-thread-comments.list.params') | |
273 | ||
274 | it('Should run filter:api.video-thread-comments.list.result', async function () { | |
275 | const res = await getVideoThreadComments(servers[0].url, videoUUID, threadId) | |
276 | ||
277 | const thread = res.body as VideoCommentThreadTree | |
278 | expect(thread.comment.text.endsWith(' <3')).to.be.true | |
279 | }) | |
280 | ||
281 | describe('Should run filter:video.auto-blacklist.result', function () { | |
282 | ||
283 | async function checkIsBlacklisted (oldRes: any, value: boolean) { | |
284 | const videoId = oldRes.body.video.uuid | |
285 | ||
286 | const res = await getVideoWithToken(servers[0].url, servers[0].accessToken, videoId) | |
287 | const video: VideoDetails = res.body | |
288 | expect(video.blacklisted).to.equal(value) | |
289 | } | |
290 | ||
291 | it('Should blacklist on upload', async function () { | |
a1587156 | 292 | const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video please blacklist me' }) |
6691c522 C |
293 | await checkIsBlacklisted(res, true) |
294 | }) | |
295 | ||
296 | it('Should blacklist on import', async function () { | |
89566f77 C |
297 | this.timeout(15000) |
298 | ||
6691c522 C |
299 | const attributes = { |
300 | name: 'video please blacklist me', | |
b488ba1e | 301 | targetUrl: getGoodVideoUrl(), |
6691c522 C |
302 | channelId: servers[0].videoChannel.id |
303 | } | |
304 | const res = await importVideo(servers[0].url, servers[0].accessToken, attributes) | |
305 | await checkIsBlacklisted(res, true) | |
306 | }) | |
307 | ||
308 | it('Should blacklist on update', async function () { | |
a1587156 | 309 | const res = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video' }) |
6691c522 C |
310 | const videoId = res.body.video.uuid |
311 | await checkIsBlacklisted(res, false) | |
312 | ||
a1587156 | 313 | await updateVideo(servers[0].url, servers[0].accessToken, videoId, { name: 'please blacklist me' }) |
6691c522 C |
314 | await checkIsBlacklisted(res, true) |
315 | }) | |
316 | ||
317 | it('Should blacklist on remote upload', async function () { | |
3d470a53 | 318 | this.timeout(120000) |
6691c522 | 319 | |
a1587156 | 320 | const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'remote please blacklist me' }) |
6691c522 C |
321 | await waitJobs(servers) |
322 | ||
323 | await checkIsBlacklisted(res, true) | |
324 | }) | |
325 | ||
326 | it('Should blacklist on remote update', async function () { | |
3d470a53 | 327 | this.timeout(120000) |
6691c522 | 328 | |
a1587156 | 329 | const res = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video' }) |
6691c522 C |
330 | await waitJobs(servers) |
331 | ||
332 | const videoId = res.body.video.uuid | |
333 | await checkIsBlacklisted(res, false) | |
334 | ||
335 | await updateVideo(servers[1].url, servers[1].accessToken, videoId, { name: 'please blacklist me' }) | |
336 | await waitJobs(servers) | |
337 | ||
338 | await checkIsBlacklisted(res, true) | |
339 | }) | |
340 | }) | |
341 | ||
4ce7eb71 C |
342 | describe('Should run filter:api.user.signup.allowed.result', function () { |
343 | ||
344 | it('Should run on config endpoint', async function () { | |
65e6e260 C |
345 | const body = await servers[0].configCommand.getConfig() |
346 | expect(body.signup.allowed).to.be.true | |
4ce7eb71 C |
347 | }) |
348 | ||
349 | it('Should allow a signup', async function () { | |
350 | await registerUser(servers[0].url, 'john', 'password') | |
351 | }) | |
352 | ||
353 | it('Should not allow a signup', async function () { | |
f2eb23cd | 354 | const res = await registerUser(servers[0].url, 'jma', 'password', HttpStatusCode.FORBIDDEN_403) |
4ce7eb71 C |
355 | |
356 | expect(res.body.error).to.equal('No jma') | |
357 | }) | |
358 | }) | |
359 | ||
4bc45da3 C |
360 | describe('Download hooks', function () { |
361 | const downloadVideos: VideoDetails[] = [] | |
362 | ||
363 | before(async function () { | |
c4244cfd | 364 | this.timeout(120000) |
4bc45da3 | 365 | |
65e6e260 C |
366 | await servers[0].configCommand.updateCustomSubConfig({ |
367 | newConfig: { | |
368 | transcoding: { | |
369 | webtorrent: { | |
370 | enabled: true | |
371 | }, | |
372 | hls: { | |
373 | enabled: true | |
374 | } | |
4bc45da3 C |
375 | } |
376 | } | |
377 | }) | |
378 | ||
379 | const uuids: string[] = [] | |
380 | ||
381 | for (const name of [ 'bad torrent', 'bad file', 'bad playlist file' ]) { | |
382 | const uuid = (await uploadVideoAndGetId({ server: servers[0], videoName: name })).uuid | |
383 | uuids.push(uuid) | |
384 | } | |
385 | ||
386 | await waitJobs(servers) | |
387 | ||
388 | for (const uuid of uuids) { | |
389 | const res = await getVideo(servers[0].url, uuid) | |
390 | downloadVideos.push(res.body) | |
391 | } | |
392 | }) | |
393 | ||
394 | it('Should run filter:api.download.torrent.allowed.result', async function () { | |
395 | const res = await makeRawRequest(downloadVideos[0].files[0].torrentDownloadUrl, 403) | |
396 | expect(res.body.error).to.equal('Liu Bei') | |
397 | ||
398 | await makeRawRequest(downloadVideos[1].files[0].torrentDownloadUrl, 200) | |
399 | await makeRawRequest(downloadVideos[2].files[0].torrentDownloadUrl, 200) | |
400 | }) | |
401 | ||
402 | it('Should run filter:api.download.video.allowed.result', async function () { | |
403 | { | |
404 | const res = await makeRawRequest(downloadVideos[1].files[0].fileDownloadUrl, 403) | |
405 | expect(res.body.error).to.equal('Cao Cao') | |
406 | ||
407 | await makeRawRequest(downloadVideos[0].files[0].fileDownloadUrl, 200) | |
408 | await makeRawRequest(downloadVideos[2].files[0].fileDownloadUrl, 200) | |
409 | } | |
410 | ||
411 | { | |
412 | const res = await makeRawRequest(downloadVideos[2].streamingPlaylists[0].files[0].fileDownloadUrl, 403) | |
413 | expect(res.body.error).to.equal('Sun Jian') | |
414 | ||
415 | await makeRawRequest(downloadVideos[2].files[0].fileDownloadUrl, 200) | |
416 | ||
417 | await makeRawRequest(downloadVideos[0].streamingPlaylists[0].files[0].fileDownloadUrl, 200) | |
418 | await makeRawRequest(downloadVideos[1].streamingPlaylists[0].files[0].fileDownloadUrl, 200) | |
419 | } | |
420 | }) | |
421 | }) | |
422 | ||
eebd9838 C |
423 | describe('Embed filters', function () { |
424 | const embedVideos: VideoDetails[] = [] | |
425 | const embedPlaylists: VideoPlaylist[] = [] | |
426 | ||
427 | before(async function () { | |
428 | this.timeout(60000) | |
429 | ||
65e6e260 C |
430 | await servers[0].configCommand.updateCustomSubConfig({ |
431 | newConfig: { | |
432 | transcoding: { | |
433 | enabled: false | |
434 | } | |
eebd9838 C |
435 | } |
436 | }) | |
437 | ||
438 | for (const name of [ 'bad embed', 'good embed' ]) { | |
439 | { | |
440 | const uuid = (await uploadVideoAndGetId({ server: servers[0], videoName: name })).uuid | |
441 | const res = await getVideo(servers[0].url, uuid) | |
442 | embedVideos.push(res.body) | |
443 | } | |
444 | ||
445 | { | |
446 | const playlistAttrs = { displayName: name, videoChannelId: servers[0].videoChannel.id, privacy: VideoPlaylistPrivacy.PUBLIC } | |
447 | const res = await createVideoPlaylist({ url: servers[0].url, token: servers[0].accessToken, playlistAttrs }) | |
448 | ||
449 | const resPlaylist = await getVideoPlaylist(servers[0].url, res.body.videoPlaylist.id) | |
450 | embedPlaylists.push(resPlaylist.body) | |
451 | } | |
452 | } | |
453 | }) | |
454 | ||
455 | it('Should run filter:html.embed.video.allowed.result', async function () { | |
456 | const res = await makeRawRequest(servers[0].url + embedVideos[0].embedPath, 200) | |
457 | expect(res.text).to.equal('Lu Bu') | |
458 | }) | |
459 | ||
460 | it('Should run filter:html.embed.video-playlist.allowed.result', async function () { | |
461 | const res = await makeRawRequest(servers[0].url + embedPlaylists[0].embedPath, 200) | |
462 | expect(res.text).to.equal('Diao Chan') | |
463 | }) | |
464 | }) | |
465 | ||
74a4d531 C |
466 | describe('Search filters', function () { |
467 | ||
468 | before(async function () { | |
65e6e260 C |
469 | await servers[0].configCommand.updateCustomSubConfig({ |
470 | newConfig: { | |
471 | search: { | |
472 | searchIndex: { | |
473 | enabled: true, | |
474 | isDefaultSearch: false, | |
475 | disableLocalSearch: false | |
476 | } | |
74a4d531 C |
477 | } |
478 | } | |
479 | }) | |
480 | }) | |
481 | ||
482 | it('Should run filter:api.search.videos.local.list.{params,result}', async function () { | |
af971e06 C |
483 | await servers[0].searchCommand.advancedVideoSearch({ |
484 | search: { | |
485 | search: 'Sun Quan' | |
486 | } | |
74a4d531 C |
487 | }) |
488 | ||
489 | await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.local.list.params', 1) | |
490 | await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.local.list.result', 1) | |
491 | }) | |
492 | ||
493 | it('Should run filter:api.search.videos.index.list.{params,result}', async function () { | |
af971e06 C |
494 | await servers[0].searchCommand.advancedVideoSearch({ |
495 | search: { | |
496 | search: 'Sun Quan', | |
497 | searchTarget: 'search-index' | |
498 | } | |
74a4d531 C |
499 | }) |
500 | ||
501 | await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.local.list.params', 1) | |
502 | await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.local.list.result', 1) | |
503 | await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.index.list.params', 1) | |
504 | await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.index.list.result', 1) | |
505 | }) | |
506 | ||
507 | it('Should run filter:api.search.video-channels.local.list.{params,result}', async function () { | |
af971e06 C |
508 | await servers[0].searchCommand.advancedChannelSearch({ |
509 | search: { | |
510 | search: 'Sun Ce' | |
511 | } | |
74a4d531 C |
512 | }) |
513 | ||
514 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.local.list.params', 1) | |
515 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.local.list.result', 1) | |
516 | }) | |
517 | ||
518 | it('Should run filter:api.search.video-channels.index.list.{params,result}', async function () { | |
af971e06 C |
519 | await servers[0].searchCommand.advancedChannelSearch({ |
520 | search: { | |
521 | search: 'Sun Ce', | |
522 | searchTarget: 'search-index' | |
523 | } | |
74a4d531 C |
524 | }) |
525 | ||
526 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.local.list.params', 1) | |
527 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.local.list.result', 1) | |
528 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.index.list.params', 1) | |
529 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.index.list.result', 1) | |
530 | }) | |
37a44fc9 C |
531 | |
532 | it('Should run filter:api.search.video-playlists.local.list.{params,result}', async function () { | |
af971e06 C |
533 | await servers[0].searchCommand.advancedPlaylistSearch({ |
534 | search: { | |
535 | search: 'Sun Jian' | |
536 | } | |
37a44fc9 C |
537 | }) |
538 | ||
539 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.local.list.params', 1) | |
540 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.local.list.result', 1) | |
541 | }) | |
542 | ||
543 | it('Should run filter:api.search.video-playlists.index.list.{params,result}', async function () { | |
af971e06 C |
544 | await servers[0].searchCommand.advancedPlaylistSearch({ |
545 | search: { | |
546 | search: 'Sun Jian', | |
547 | searchTarget: 'search-index' | |
548 | } | |
37a44fc9 C |
549 | }) |
550 | ||
551 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.local.list.params', 1) | |
552 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.local.list.result', 1) | |
553 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.index.list.params', 1) | |
554 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.index.list.result', 1) | |
555 | }) | |
74a4d531 C |
556 | }) |
557 | ||
9b474844 | 558 | after(async function () { |
89cd1275 | 559 | await cleanupTests(servers) |
9b474844 C |
560 | }) |
561 | }) |