diff options
Diffstat (limited to 'server/tests/api/videos/video-nsfw.ts')
-rw-r--r-- | server/tests/api/videos/video-nsfw.ts | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts index b16b484b9..6c98c9f12 100644 --- a/server/tests/api/videos/video-nsfw.ts +++ b/server/tests/api/videos/video-nsfw.ts | |||
@@ -1,34 +1,33 @@ | |||
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' |
5 | import { cleanupTests, getVideosList, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../../../shared/extra-utils/index' | 4 | import * as chai from 'chai' |
6 | import { userLogin } from '../../../../shared/extra-utils/users/login' | ||
7 | import { createUser } from '../../../../shared/extra-utils/users/users' | ||
8 | import { getMyVideos } from '../../../../shared/extra-utils/videos/videos' | ||
9 | import { | 5 | import { |
6 | cleanupTests, | ||
7 | createUser, | ||
10 | flushAndRunServer, | 8 | flushAndRunServer, |
11 | getAccountVideos, | 9 | getAccountVideos, |
12 | getConfig, | 10 | getConfig, |
13 | getCustomConfig, | 11 | getCustomConfig, |
14 | getMyUserInformation, | 12 | getMyUserInformation, |
13 | getMyVideos, | ||
15 | getVideoChannelVideos, | 14 | getVideoChannelVideos, |
15 | getVideosList, | ||
16 | getVideosListWithToken, | 16 | getVideosListWithToken, |
17 | searchVideo, | 17 | searchVideo, |
18 | searchVideoWithToken, | 18 | searchVideoWithToken, |
19 | ServerInfo, | ||
20 | setAccessTokensToServers, | ||
19 | updateCustomConfig, | 21 | updateCustomConfig, |
20 | updateMyUser | 22 | updateMyUser, |
21 | } from '../../../../shared/extra-utils' | 23 | uploadVideo, |
22 | import { ServerConfig, VideosOverview } from '../../../../shared/models' | 24 | userLogin |
23 | import { CustomConfig } from '../../../../shared/models/server/custom-config.model' | 25 | } from '@shared/extra-utils' |
24 | import { User } from '../../../../shared/models/users' | 26 | import { CustomConfig, ServerConfig, User, VideosOverview } from '@shared/models' |
25 | import { getVideosOverview, getVideosOverviewWithToken } from '@shared/extra-utils/overviews/overviews' | ||
26 | 27 | ||
27 | const expect = chai.expect | 28 | const expect = chai.expect |
28 | 29 | ||
29 | function createOverviewRes (res: any) { | 30 | function createOverviewRes (overview: VideosOverview) { |
30 | const overview = res.body as VideosOverview | ||
31 | |||
32 | const videos = overview.categories[0].videos | 31 | const videos = overview.categories[0].videos |
33 | return { body: { data: videos, total: videos.length } } | 32 | return { body: { data: videos, total: videos.length } } |
34 | } | 33 | } |
@@ -57,7 +56,9 @@ describe('Test video NSFW policy', function () { | |||
57 | 56 | ||
58 | // Overviews do not support video filters | 57 | // Overviews do not support video filters |
59 | if (!hasQuery) { | 58 | if (!hasQuery) { |
60 | promises.push(getVideosOverviewWithToken(server.url, 1, token).then(res => createOverviewRes(res))) | 59 | const p = server.overviewsCommand.getVideos({ page: 1, token }) |
60 | .then(res => createOverviewRes(res)) | ||
61 | promises.push(p) | ||
61 | } | 62 | } |
62 | 63 | ||
63 | return Promise.all(promises) | 64 | return Promise.all(promises) |
@@ -72,7 +73,9 @@ describe('Test video NSFW policy', function () { | |||
72 | 73 | ||
73 | // Overviews do not support video filters | 74 | // Overviews do not support video filters |
74 | if (!hasQuery) { | 75 | if (!hasQuery) { |
75 | promises.push(getVideosOverview(server.url, 1).then(res => createOverviewRes(res))) | 76 | const p = server.overviewsCommand.getVideos({ page: 1 }) |
77 | .then(res => createOverviewRes(res)) | ||
78 | promises.push(p) | ||
76 | } | 79 | } |
77 | 80 | ||
78 | return Promise.all(promises) | 81 | return Promise.all(promises) |