aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/search
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-06-12 16:24:58 +0200
committerChocobozzz <me@florianbigard.com>2020-06-12 16:27:41 +0200
commit1a40132c67e50c94a7bd3f6b63c075f471b3d6cc (patch)
tree95e4c4c36fcff9eab74648dd3bfb0f33dae9e0e9 /server/tests/api/search
parent5a61ffbb7c72dd7ecfa16c7944dac45411c1bbe9 (diff)
downloadPeerTube-1a40132c67e50c94a7bd3f6b63c075f471b3d6cc.tar.gz
PeerTube-1a40132c67e50c94a7bd3f6b63c075f471b3d6cc.tar.zst
PeerTube-1a40132c67e50c94a7bd3f6b63c075f471b3d6cc.zip
Use default nsfw instance policy for search index
Diffstat (limited to 'server/tests/api/search')
-rw-r--r--server/tests/api/search/search-index.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/server/tests/api/search/search-index.ts b/server/tests/api/search/search-index.ts
index 2354aaa8b..40065d162 100644
--- a/server/tests/api/search/search-index.ts
+++ b/server/tests/api/search/search-index.ts
@@ -209,6 +209,37 @@ describe('Test videos search', function () {
209 expect(res.body.total).to.be.greaterThan(5) 209 expect(res.body.total).to.be.greaterThan(5)
210 expect(res.body.data).to.have.lengthOf(5) 210 expect(res.body.data).to.have.lengthOf(5)
211 }) 211 })
212
213 it('Should use the nsfw instance policy as default', async function () {
214 let nsfwUUID: string
215
216 {
217 await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'display' } })
218
219 const res = await searchVideo(server.url, 'NSFW search index')
220 const video = res.body.data[0] as Video
221
222 expect(res.body.data).to.have.length.greaterThan(0)
223 expect(video.nsfw).to.be.true
224
225 nsfwUUID = video.uuid
226 }
227
228 {
229 await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'do_not_list' } })
230
231 const res = await searchVideo(server.url, 'NSFW search index')
232
233 try {
234 expect(res.body.data).to.have.lengthOf(0)
235 } catch (err) {
236 //
237 const video = res.body.data[0] as Video
238
239 expect(video.uuid).not.equal(nsfwUUID)
240 }
241 }
242 })
212 }) 243 })
213 244
214 describe('Channels search', async function () { 245 describe('Channels search', async function () {