aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-nsfw.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-20 14:35:18 +0200
committerChocobozzz <me@florianbigard.com>2018-07-24 14:04:05 +0200
commitd525fc399a14a8b16eaad6d4c0bc0a9c4093c3c9 (patch)
tree4305044c4a97bdf1275b241c63cb0e85151cfb6a /server/tests/api/videos/video-nsfw.ts
parent57c36b277e68b764dd34cb2e449f6e2ca3d1e9b6 (diff)
downloadPeerTube-d525fc399a14a8b16eaad6d4c0bc0a9c4093c3c9.tar.gz
PeerTube-d525fc399a14a8b16eaad6d4c0bc0a9c4093c3c9.tar.zst
PeerTube-d525fc399a14a8b16eaad6d4c0bc0a9c4093c3c9.zip
Add videos list filters
Diffstat (limited to 'server/tests/api/videos/video-nsfw.ts')
-rw-r--r--server/tests/api/videos/video-nsfw.ts30
1 files changed, 25 insertions, 5 deletions
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts
index 6af0ca8af..38bdaa54e 100644
--- a/server/tests/api/videos/video-nsfw.ts
+++ b/server/tests/api/videos/video-nsfw.ts
@@ -30,7 +30,7 @@ describe('Test video NSFW policy', function () {
30 let userAccessToken: string 30 let userAccessToken: string
31 let customConfig: CustomConfig 31 let customConfig: CustomConfig
32 32
33 function getVideosFunctions (token?: string) { 33 function getVideosFunctions (token?: string, query = {}) {
34 return getMyUserInformation(server.url, server.accessToken) 34 return getMyUserInformation(server.url, server.accessToken)
35 .then(res => { 35 .then(res => {
36 const user: User = res.body 36 const user: User = res.body
@@ -39,10 +39,10 @@ describe('Test video NSFW policy', function () {
39 39
40 if (token) { 40 if (token) {
41 return Promise.all([ 41 return Promise.all([
42 getVideosListWithToken(server.url, token), 42 getVideosListWithToken(server.url, token, query),
43 searchVideoWithToken(server.url, 'n', token), 43 searchVideoWithToken(server.url, 'n', token, query),
44 getAccountVideos(server.url, token, accountName, 0, 5), 44 getAccountVideos(server.url, token, accountName, 0, 5, undefined, query),
45 getVideoChannelVideos(server.url, token, videoChannelUUID, 0, 5) 45 getVideoChannelVideos(server.url, token, videoChannelUUID, 0, 5, undefined, query)
46 ]) 46 ])
47 } 47 }
48 48
@@ -200,6 +200,26 @@ describe('Test video NSFW policy', function () {
200 expect(videos[ 0 ].name).to.equal('normal') 200 expect(videos[ 0 ].name).to.equal('normal')
201 expect(videos[ 1 ].name).to.equal('nsfw') 201 expect(videos[ 1 ].name).to.equal('nsfw')
202 }) 202 })
203
204 it('Should display NSFW videos when the nsfw param === true', async function () {
205 for (const res of await getVideosFunctions(server.accessToken, { nsfw: true })) {
206 expect(res.body.total).to.equal(1)
207
208 const videos = res.body.data
209 expect(videos).to.have.lengthOf(1)
210 expect(videos[ 0 ].name).to.equal('nsfw')
211 }
212 })
213
214 it('Should hide NSFW videos when the nsfw param === true', async function () {
215 for (const res of await getVideosFunctions(server.accessToken, { nsfw: false })) {
216 expect(res.body.total).to.equal(1)
217
218 const videos = res.body.data
219 expect(videos).to.have.lengthOf(1)
220 expect(videos[ 0 ].name).to.equal('normal')
221 }
222 })
203 }) 223 })
204 224
205 after(async function () { 225 after(async function () {