diff options
Diffstat (limited to 'server/tests/plugins')
-rw-r--r-- | server/tests/plugins/filter-hooks.ts | 62 |
1 files changed, 37 insertions, 25 deletions
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts index 644b41dea..e2ec5457b 100644 --- a/server/tests/plugins/filter-hooks.ts +++ b/server/tests/plugins/filter-hooks.ts | |||
@@ -2,17 +2,15 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { advancedVideoChannelSearch } from '@shared/extra-utils/search/video-channels' | 5 | import { HttpStatusCode } from '@shared/core-utils' |
6 | import { ServerConfig } from '@shared/models' | ||
7 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
8 | import { | 6 | import { |
9 | addVideoCommentReply, | 7 | addVideoCommentReply, |
10 | addVideoCommentThread, | 8 | addVideoCommentThread, |
11 | advancedVideoPlaylistSearch, | 9 | cleanupTests, |
12 | advancedVideosSearch, | ||
13 | createLive, | 10 | createLive, |
14 | createVideoPlaylist, | 11 | createVideoPlaylist, |
15 | doubleFollow, | 12 | doubleFollow, |
13 | flushAndRunMultipleServers, | ||
16 | getAccountVideos, | 14 | getAccountVideos, |
17 | getConfig, | 15 | getConfig, |
18 | getMyVideos, | 16 | getMyVideos, |
@@ -28,17 +26,19 @@ import { | |||
28 | installPlugin, | 26 | installPlugin, |
29 | makeRawRequest, | 27 | makeRawRequest, |
30 | registerUser, | 28 | registerUser, |
29 | ServerInfo, | ||
31 | setAccessTokensToServers, | 30 | setAccessTokensToServers, |
32 | setDefaultVideoChannel, | 31 | setDefaultVideoChannel, |
33 | updateCustomSubConfig, | 32 | updateCustomSubConfig, |
34 | updateVideo, | 33 | updateVideo, |
35 | uploadVideo, | 34 | uploadVideo, |
36 | uploadVideoAndGetId, | 35 | uploadVideoAndGetId, |
37 | waitJobs | 36 | waitJobs, |
38 | } from '../../../shared/extra-utils' | 37 | waitUntilLog |
39 | import { cleanupTests, flushAndRunMultipleServers, ServerInfo, waitUntilLog } from '../../../shared/extra-utils/server/servers' | 38 | } from '@shared/extra-utils' |
40 | import { getGoodVideoUrl, getMyVideoImports, importVideo } from '../../../shared/extra-utils/videos/video-imports' | 39 | import { getGoodVideoUrl, getMyVideoImports, importVideo } from '@shared/extra-utils/videos/video-imports' |
41 | import { | 40 | import { |
41 | ServerConfig, | ||
42 | VideoCommentThreadTree, | 42 | VideoCommentThreadTree, |
43 | VideoDetails, | 43 | VideoDetails, |
44 | VideoImport, | 44 | VideoImport, |
@@ -46,7 +46,7 @@ import { | |||
46 | VideoPlaylist, | 46 | VideoPlaylist, |
47 | VideoPlaylistPrivacy, | 47 | VideoPlaylistPrivacy, |
48 | VideoPrivacy | 48 | VideoPrivacy |
49 | } from '../../../shared/models/videos' | 49 | } from '@shared/models' |
50 | 50 | ||
51 | const expect = chai.expect | 51 | const expect = chai.expect |
52 | 52 | ||
@@ -486,8 +486,10 @@ describe('Test plugin filter hooks', function () { | |||
486 | }) | 486 | }) |
487 | 487 | ||
488 | it('Should run filter:api.search.videos.local.list.{params,result}', async function () { | 488 | it('Should run filter:api.search.videos.local.list.{params,result}', async function () { |
489 | await advancedVideosSearch(servers[0].url, { | 489 | await servers[0].searchCommand.advancedVideoSearch({ |
490 | search: 'Sun Quan' | 490 | search: { |
491 | search: 'Sun Quan' | ||
492 | } | ||
491 | }) | 493 | }) |
492 | 494 | ||
493 | await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.local.list.params', 1) | 495 | await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.local.list.params', 1) |
@@ -495,9 +497,11 @@ describe('Test plugin filter hooks', function () { | |||
495 | }) | 497 | }) |
496 | 498 | ||
497 | it('Should run filter:api.search.videos.index.list.{params,result}', async function () { | 499 | it('Should run filter:api.search.videos.index.list.{params,result}', async function () { |
498 | await advancedVideosSearch(servers[0].url, { | 500 | await servers[0].searchCommand.advancedVideoSearch({ |
499 | search: 'Sun Quan', | 501 | search: { |
500 | searchTarget: 'search-index' | 502 | search: 'Sun Quan', |
503 | searchTarget: 'search-index' | ||
504 | } | ||
501 | }) | 505 | }) |
502 | 506 | ||
503 | await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.local.list.params', 1) | 507 | await waitUntilLog(servers[0], 'Run hook filter:api.search.videos.local.list.params', 1) |
@@ -507,8 +511,10 @@ describe('Test plugin filter hooks', function () { | |||
507 | }) | 511 | }) |
508 | 512 | ||
509 | it('Should run filter:api.search.video-channels.local.list.{params,result}', async function () { | 513 | it('Should run filter:api.search.video-channels.local.list.{params,result}', async function () { |
510 | await advancedVideoChannelSearch(servers[0].url, { | 514 | await servers[0].searchCommand.advancedChannelSearch({ |
511 | search: 'Sun Ce' | 515 | search: { |
516 | search: 'Sun Ce' | ||
517 | } | ||
512 | }) | 518 | }) |
513 | 519 | ||
514 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.local.list.params', 1) | 520 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.local.list.params', 1) |
@@ -516,9 +522,11 @@ describe('Test plugin filter hooks', function () { | |||
516 | }) | 522 | }) |
517 | 523 | ||
518 | it('Should run filter:api.search.video-channels.index.list.{params,result}', async function () { | 524 | it('Should run filter:api.search.video-channels.index.list.{params,result}', async function () { |
519 | await advancedVideoChannelSearch(servers[0].url, { | 525 | await servers[0].searchCommand.advancedChannelSearch({ |
520 | search: 'Sun Ce', | 526 | search: { |
521 | searchTarget: 'search-index' | 527 | search: 'Sun Ce', |
528 | searchTarget: 'search-index' | ||
529 | } | ||
522 | }) | 530 | }) |
523 | 531 | ||
524 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.local.list.params', 1) | 532 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-channels.local.list.params', 1) |
@@ -528,8 +536,10 @@ describe('Test plugin filter hooks', function () { | |||
528 | }) | 536 | }) |
529 | 537 | ||
530 | it('Should run filter:api.search.video-playlists.local.list.{params,result}', async function () { | 538 | it('Should run filter:api.search.video-playlists.local.list.{params,result}', async function () { |
531 | await advancedVideoPlaylistSearch(servers[0].url, { | 539 | await servers[0].searchCommand.advancedPlaylistSearch({ |
532 | search: 'Sun Jian' | 540 | search: { |
541 | search: 'Sun Jian' | ||
542 | } | ||
533 | }) | 543 | }) |
534 | 544 | ||
535 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.local.list.params', 1) | 545 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.local.list.params', 1) |
@@ -537,9 +547,11 @@ describe('Test plugin filter hooks', function () { | |||
537 | }) | 547 | }) |
538 | 548 | ||
539 | it('Should run filter:api.search.video-playlists.index.list.{params,result}', async function () { | 549 | it('Should run filter:api.search.video-playlists.index.list.{params,result}', async function () { |
540 | await advancedVideoPlaylistSearch(servers[0].url, { | 550 | await servers[0].searchCommand.advancedPlaylistSearch({ |
541 | search: 'Sun Jian', | 551 | search: { |
542 | searchTarget: 'search-index' | 552 | search: 'Sun Jian', |
553 | searchTarget: 'search-index' | ||
554 | } | ||
543 | }) | 555 | }) |
544 | 556 | ||
545 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.local.list.params', 1) | 557 | await waitUntilLog(servers[0], 'Run hook filter:api.search.video-playlists.local.list.params', 1) |