aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-nsfw.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-07 11:51:09 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:17 +0200
commit65e6e2602c0d5521f3a6740f7469bb92830ecb53 (patch)
treef89024ffff1dafb0281ee2fe028e89b95101bd44 /server/tests/api/videos/video-nsfw.ts
parentbc8090411ddaa8d742ce4de3c83f9dba7bc18e2a (diff)
downloadPeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.tar.gz
PeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.tar.zst
PeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.zip
Introduce config command
Diffstat (limited to 'server/tests/api/videos/video-nsfw.ts')
-rw-r--r--server/tests/api/videos/video-nsfw.ts25
1 files changed, 8 insertions, 17 deletions
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts
index 24a4c6152..65813517d 100644
--- a/server/tests/api/videos/video-nsfw.ts
+++ b/server/tests/api/videos/video-nsfw.ts
@@ -7,8 +7,6 @@ import {
7 createUser, 7 createUser,
8 flushAndRunServer, 8 flushAndRunServer,
9 getAccountVideos, 9 getAccountVideos,
10 getConfig,
11 getCustomConfig,
12 getMyUserInformation, 10 getMyUserInformation,
13 getMyVideos, 11 getMyVideos,
14 getVideoChannelVideos, 12 getVideoChannelVideos,
@@ -16,12 +14,11 @@ import {
16 getVideosListWithToken, 14 getVideosListWithToken,
17 ServerInfo, 15 ServerInfo,
18 setAccessTokensToServers, 16 setAccessTokensToServers,
19 updateCustomConfig,
20 updateMyUser, 17 updateMyUser,
21 uploadVideo, 18 uploadVideo,
22 userLogin 19 userLogin
23} from '@shared/extra-utils' 20} from '@shared/extra-utils'
24import { BooleanBothQuery, CustomConfig, ServerConfig, User, VideosOverview } from '@shared/models' 21import { BooleanBothQuery, CustomConfig, User, VideosOverview } from '@shared/models'
25 22
26const expect = chai.expect 23const expect = chai.expect
27 24
@@ -97,16 +94,12 @@ describe('Test video NSFW policy', function () {
97 await uploadVideo(server.url, server.accessToken, attributes) 94 await uploadVideo(server.url, server.accessToken, attributes)
98 } 95 }
99 96
100 { 97 customConfig = await server.configCommand.getCustomConfig()
101 const res = await getCustomConfig(server.url, server.accessToken)
102 customConfig = res.body
103 }
104 }) 98 })
105 99
106 describe('Instance default NSFW policy', function () { 100 describe('Instance default NSFW policy', function () {
107 it('Should display NSFW videos with display default NSFW policy', async function () { 101 it('Should display NSFW videos with display default NSFW policy', async function () {
108 const resConfig = await getConfig(server.url) 102 const serverConfig = await server.configCommand.getConfig()
109 const serverConfig: ServerConfig = resConfig.body
110 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('display') 103 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('display')
111 104
112 for (const res of await getVideosFunctions()) { 105 for (const res of await getVideosFunctions()) {
@@ -121,10 +114,9 @@ describe('Test video NSFW policy', function () {
121 114
122 it('Should not display NSFW videos with do_not_list default NSFW policy', async function () { 115 it('Should not display NSFW videos with do_not_list default NSFW policy', async function () {
123 customConfig.instance.defaultNSFWPolicy = 'do_not_list' 116 customConfig.instance.defaultNSFWPolicy = 'do_not_list'
124 await updateCustomConfig(server.url, server.accessToken, customConfig) 117 await server.configCommand.updateCustomConfig({ newCustomConfig: customConfig })
125 118
126 const resConfig = await getConfig(server.url) 119 const serverConfig = await server.configCommand.getConfig()
127 const serverConfig: ServerConfig = resConfig.body
128 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('do_not_list') 120 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('do_not_list')
129 121
130 for (const res of await getVideosFunctions()) { 122 for (const res of await getVideosFunctions()) {
@@ -138,10 +130,9 @@ describe('Test video NSFW policy', function () {
138 130
139 it('Should display NSFW videos with blur default NSFW policy', async function () { 131 it('Should display NSFW videos with blur default NSFW policy', async function () {
140 customConfig.instance.defaultNSFWPolicy = 'blur' 132 customConfig.instance.defaultNSFWPolicy = 'blur'
141 await updateCustomConfig(server.url, server.accessToken, customConfig) 133 await server.configCommand.updateCustomConfig({ newCustomConfig: customConfig })
142 134
143 const resConfig = await getConfig(server.url) 135 const serverConfig = await server.configCommand.getConfig()
144 const serverConfig: ServerConfig = resConfig.body
145 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('blur') 136 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('blur')
146 137
147 for (const res of await getVideosFunctions()) { 138 for (const res of await getVideosFunctions()) {
@@ -172,7 +163,7 @@ describe('Test video NSFW policy', function () {
172 163
173 it('Should display NSFW videos with blur user NSFW policy', async function () { 164 it('Should display NSFW videos with blur user NSFW policy', async function () {
174 customConfig.instance.defaultNSFWPolicy = 'do_not_list' 165 customConfig.instance.defaultNSFWPolicy = 'do_not_list'
175 await updateCustomConfig(server.url, server.accessToken, customConfig) 166 await server.configCommand.updateCustomConfig({ newCustomConfig: customConfig })
176 167
177 for (const res of await getVideosFunctions(userAccessToken)) { 168 for (const res of await getVideosFunctions(userAccessToken)) {
178 expect(res.body.total).to.equal(2) 169 expect(res.body.total).to.equal(2)