aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-nsfw.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos/video-nsfw.ts')
-rw-r--r--server/tests/api/videos/video-nsfw.ts35
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
3import * as chai from 'chai'
4import 'mocha' 3import 'mocha'
5import { cleanupTests, getVideosList, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../../../shared/extra-utils/index' 4import * as chai from 'chai'
6import { userLogin } from '../../../../shared/extra-utils/users/login'
7import { createUser } from '../../../../shared/extra-utils/users/users'
8import { getMyVideos } from '../../../../shared/extra-utils/videos/videos'
9import { 5import {
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,
22import { ServerConfig, VideosOverview } from '../../../../shared/models' 24 userLogin
23import { CustomConfig } from '../../../../shared/models/server/custom-config.model' 25} from '@shared/extra-utils'
24import { User } from '../../../../shared/models/users' 26import { CustomConfig, ServerConfig, User, VideosOverview } from '@shared/models'
25import { getVideosOverview, getVideosOverviewWithToken } from '@shared/extra-utils/overviews/overviews'
26 27
27const expect = chai.expect 28const expect = chai.expect
28 29
29function createOverviewRes (res: any) { 30function 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)