aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/moderation/video-blacklist.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 09:04:35 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit89d241a79c262b9775c233b73cff080043ebb5e6 (patch)
treecb3b6cb431d25d891ef4e02f66c61d252d17048f /server/tests/api/moderation/video-blacklist.ts
parentd23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff)
downloadPeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip
Shorter server command names
Diffstat (limited to 'server/tests/api/moderation/video-blacklist.ts')
-rw-r--r--server/tests/api/moderation/video-blacklist.ts58
1 files changed, 29 insertions, 29 deletions
diff --git a/server/tests/api/moderation/video-blacklist.ts b/server/tests/api/moderation/video-blacklist.ts
index 2f2e678e7..d23d23bcb 100644
--- a/server/tests/api/moderation/video-blacklist.ts
+++ b/server/tests/api/moderation/video-blacklist.ts
@@ -25,10 +25,10 @@ describe('Test video blacklist', function () {
25 let command: BlacklistCommand 25 let command: BlacklistCommand
26 26
27 async function blacklistVideosOnServer (server: ServerInfo) { 27 async function blacklistVideosOnServer (server: ServerInfo) {
28 const { data } = await server.videosCommand.list() 28 const { data } = await server.videos.list()
29 29
30 for (const video of data) { 30 for (const video of data) {
31 await server.blacklistCommand.add({ videoId: video.id, reason: 'super reason' }) 31 await server.blacklist.add({ videoId: video.id, reason: 'super reason' })
32 } 32 }
33 } 33 }
34 34
@@ -45,13 +45,13 @@ describe('Test video blacklist', function () {
45 await doubleFollow(servers[0], servers[1]) 45 await doubleFollow(servers[0], servers[1])
46 46
47 // Upload 2 videos on server 2 47 // Upload 2 videos on server 2
48 await servers[1].videosCommand.upload({ attributes: { name: 'My 1st video', description: 'A video on server 2' } }) 48 await servers[1].videos.upload({ attributes: { name: 'My 1st video', description: 'A video on server 2' } })
49 await servers[1].videosCommand.upload({ attributes: { name: 'My 2nd video', description: 'A video on server 2' } }) 49 await servers[1].videos.upload({ attributes: { name: 'My 2nd video', description: 'A video on server 2' } })
50 50
51 // Wait videos propagation, server 2 has transcoding enabled 51 // Wait videos propagation, server 2 has transcoding enabled
52 await waitJobs(servers) 52 await waitJobs(servers)
53 53
54 command = servers[0].blacklistCommand 54 command = servers[0].blacklist
55 55
56 // Blacklist the two videos on server 1 56 // Blacklist the two videos on server 1
57 await blacklistVideosOnServer(servers[0]) 57 await blacklistVideosOnServer(servers[0])
@@ -61,7 +61,7 @@ describe('Test video blacklist', function () {
61 61
62 it('Should not have the video blacklisted in videos list/search on server 1', async function () { 62 it('Should not have the video blacklisted in videos list/search on server 1', async function () {
63 { 63 {
64 const { total, data } = await servers[0].videosCommand.list() 64 const { total, data } = await servers[0].videos.list()
65 65
66 expect(total).to.equal(0) 66 expect(total).to.equal(0)
67 expect(data).to.be.an('array') 67 expect(data).to.be.an('array')
@@ -69,7 +69,7 @@ describe('Test video blacklist', function () {
69 } 69 }
70 70
71 { 71 {
72 const body = await servers[0].searchCommand.searchVideos({ search: 'video' }) 72 const body = await servers[0].search.searchVideos({ search: 'video' })
73 73
74 expect(body.total).to.equal(0) 74 expect(body.total).to.equal(0)
75 expect(body.data).to.be.an('array') 75 expect(body.data).to.be.an('array')
@@ -79,7 +79,7 @@ describe('Test video blacklist', function () {
79 79
80 it('Should have the blacklisted video in videos list/search on server 2', async function () { 80 it('Should have the blacklisted video in videos list/search on server 2', async function () {
81 { 81 {
82 const { total, data } = await servers[1].videosCommand.list() 82 const { total, data } = await servers[1].videos.list()
83 83
84 expect(total).to.equal(2) 84 expect(total).to.equal(2)
85 expect(data).to.be.an('array') 85 expect(data).to.be.an('array')
@@ -87,7 +87,7 @@ describe('Test video blacklist', function () {
87 } 87 }
88 88
89 { 89 {
90 const body = await servers[1].searchCommand.searchVideos({ search: 'video' }) 90 const body = await servers[1].search.searchVideos({ search: 'video' })
91 91
92 expect(body.total).to.equal(2) 92 expect(body.total).to.equal(2)
93 expect(body.data).to.be.an('array') 93 expect(body.data).to.be.an('array')
@@ -181,7 +181,7 @@ describe('Test video blacklist', function () {
181 it('Should display blacklisted videos', async function () { 181 it('Should display blacklisted videos', async function () {
182 await blacklistVideosOnServer(servers[1]) 182 await blacklistVideosOnServer(servers[1])
183 183
184 const { total, data } = await servers[1].videosCommand.listMyVideos() 184 const { total, data } = await servers[1].videos.listMyVideos()
185 185
186 expect(total).to.equal(2) 186 expect(total).to.equal(2)
187 expect(data).to.have.lengthOf(2) 187 expect(data).to.have.lengthOf(2)
@@ -198,7 +198,7 @@ describe('Test video blacklist', function () {
198 let blacklist = [] 198 let blacklist = []
199 199
200 it('Should not have any video in videos list on server 1', async function () { 200 it('Should not have any video in videos list on server 1', async function () {
201 const { total, data } = await servers[0].videosCommand.list() 201 const { total, data } = await servers[0].videos.list()
202 expect(total).to.equal(0) 202 expect(total).to.equal(0)
203 expect(data).to.be.an('array') 203 expect(data).to.be.an('array')
204 expect(data.length).to.equal(0) 204 expect(data.length).to.equal(0)
@@ -215,7 +215,7 @@ describe('Test video blacklist', function () {
215 }) 215 })
216 216
217 it('Should have the ex-blacklisted video in videos list on server 1', async function () { 217 it('Should have the ex-blacklisted video in videos list on server 1', async function () {
218 const { total, data } = await servers[0].videosCommand.list() 218 const { total, data } = await servers[0].videos.list()
219 expect(total).to.equal(1) 219 expect(total).to.equal(1)
220 220
221 expect(data).to.be.an('array') 221 expect(data).to.be.an('array')
@@ -244,11 +244,11 @@ describe('Test video blacklist', function () {
244 this.timeout(10000) 244 this.timeout(10000)
245 245
246 { 246 {
247 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'Video 3' } }) 247 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'Video 3' } })
248 video3UUID = uuid 248 video3UUID = uuid
249 } 249 }
250 { 250 {
251 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'Video 4' } }) 251 const { uuid } = await servers[0].videos.upload({ attributes: { name: 'Video 4' } })
252 video4UUID = uuid 252 video4UUID = uuid
253 } 253 }
254 254
@@ -263,12 +263,12 @@ describe('Test video blacklist', function () {
263 await waitJobs(servers) 263 await waitJobs(servers)
264 264
265 { 265 {
266 const { data } = await servers[0].videosCommand.list() 266 const { data } = await servers[0].videos.list()
267 expect(data.find(v => v.uuid === video3UUID)).to.be.undefined 267 expect(data.find(v => v.uuid === video3UUID)).to.be.undefined
268 } 268 }
269 269
270 { 270 {
271 const { data } = await servers[1].videosCommand.list() 271 const { data } = await servers[1].videos.list()
272 expect(data.find(v => v.uuid === video3UUID)).to.not.be.undefined 272 expect(data.find(v => v.uuid === video3UUID)).to.not.be.undefined
273 } 273 }
274 }) 274 })
@@ -281,7 +281,7 @@ describe('Test video blacklist', function () {
281 await waitJobs(servers) 281 await waitJobs(servers)
282 282
283 for (const server of servers) { 283 for (const server of servers) {
284 const { data } = await server.videosCommand.list() 284 const { data } = await server.videos.list()
285 expect(data.find(v => v.uuid === video4UUID)).to.be.undefined 285 expect(data.find(v => v.uuid === video4UUID)).to.be.undefined
286 } 286 }
287 }) 287 })
@@ -289,12 +289,12 @@ describe('Test video blacklist', function () {
289 it('Should have the video unfederated even after an Update AP message', async function () { 289 it('Should have the video unfederated even after an Update AP message', async function () {
290 this.timeout(10000) 290 this.timeout(10000)
291 291
292 await servers[0].videosCommand.update({ id: video4UUID, attributes: { description: 'super description' } }) 292 await servers[0].videos.update({ id: video4UUID, attributes: { description: 'super description' } })
293 293
294 await waitJobs(servers) 294 await waitJobs(servers)
295 295
296 for (const server of servers) { 296 for (const server of servers) {
297 const { data } = await server.videosCommand.list() 297 const { data } = await server.videos.list()
298 expect(data.find(v => v.uuid === video4UUID)).to.be.undefined 298 expect(data.find(v => v.uuid === video4UUID)).to.be.undefined
299 } 299 }
300 }) 300 })
@@ -318,7 +318,7 @@ describe('Test video blacklist', function () {
318 await waitJobs(servers) 318 await waitJobs(servers)
319 319
320 for (const server of servers) { 320 for (const server of servers) {
321 const { data } = await server.videosCommand.list() 321 const { data } = await server.videos.list()
322 expect(data.find(v => v.uuid === video4UUID)).to.not.be.undefined 322 expect(data.find(v => v.uuid === video4UUID)).to.not.be.undefined
323 } 323 }
324 }) 324 })
@@ -348,36 +348,36 @@ describe('Test video blacklist', function () {
348 348
349 { 349 {
350 const user = { username: 'user_without_flag', password: 'password' } 350 const user = { username: 'user_without_flag', password: 'password' }
351 await servers[0].usersCommand.create({ 351 await servers[0].users.create({
352 username: user.username, 352 username: user.username,
353 adminFlags: UserAdminFlag.NONE, 353 adminFlags: UserAdminFlag.NONE,
354 password: user.password, 354 password: user.password,
355 role: UserRole.USER 355 role: UserRole.USER
356 }) 356 })
357 357
358 userWithoutFlag = await servers[0].loginCommand.getAccessToken(user) 358 userWithoutFlag = await servers[0].login.getAccessToken(user)
359 359
360 const { videoChannels } = await servers[0].usersCommand.getMyInfo({ token: userWithoutFlag }) 360 const { videoChannels } = await servers[0].users.getMyInfo({ token: userWithoutFlag })
361 channelOfUserWithoutFlag = videoChannels[0].id 361 channelOfUserWithoutFlag = videoChannels[0].id
362 } 362 }
363 363
364 { 364 {
365 const user = { username: 'user_with_flag', password: 'password' } 365 const user = { username: 'user_with_flag', password: 'password' }
366 await servers[0].usersCommand.create({ 366 await servers[0].users.create({
367 username: user.username, 367 username: user.username,
368 adminFlags: UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST, 368 adminFlags: UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST,
369 password: user.password, 369 password: user.password,
370 role: UserRole.USER 370 role: UserRole.USER
371 }) 371 })
372 372
373 userWithFlag = await servers[0].loginCommand.getAccessToken(user) 373 userWithFlag = await servers[0].login.getAccessToken(user)
374 } 374 }
375 375
376 await waitJobs(servers) 376 await waitJobs(servers)
377 }) 377 })
378 378
379 it('Should auto blacklist a video on upload', async function () { 379 it('Should auto blacklist a video on upload', async function () {
380 await servers[0].videosCommand.upload({ token: userWithoutFlag, attributes: { name: 'blacklisted' } }) 380 await servers[0].videos.upload({ token: userWithoutFlag, attributes: { name: 'blacklisted' } })
381 381
382 const body = await command.list({ type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED }) 382 const body = await command.list({ type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED })
383 expect(body.total).to.equal(1) 383 expect(body.total).to.equal(1)
@@ -392,7 +392,7 @@ describe('Test video blacklist', function () {
392 name: 'URL import', 392 name: 'URL import',
393 channelId: channelOfUserWithoutFlag 393 channelId: channelOfUserWithoutFlag
394 } 394 }
395 await servers[0].importsCommand.importVideo({ token: userWithoutFlag, attributes }) 395 await servers[0].imports.importVideo({ token: userWithoutFlag, attributes })
396 396
397 const body = await command.list({ sort: 'createdAt', type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED }) 397 const body = await command.list({ sort: 'createdAt', type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED })
398 expect(body.total).to.equal(2) 398 expect(body.total).to.equal(2)
@@ -405,7 +405,7 @@ describe('Test video blacklist', function () {
405 name: 'Torrent import', 405 name: 'Torrent import',
406 channelId: channelOfUserWithoutFlag 406 channelId: channelOfUserWithoutFlag
407 } 407 }
408 await servers[0].importsCommand.importVideo({ token: userWithoutFlag, attributes }) 408 await servers[0].imports.importVideo({ token: userWithoutFlag, attributes })
409 409
410 const body = await command.list({ sort: 'createdAt', type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED }) 410 const body = await command.list({ sort: 'createdAt', type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED })
411 expect(body.total).to.equal(3) 411 expect(body.total).to.equal(3)
@@ -413,7 +413,7 @@ describe('Test video blacklist', function () {
413 }) 413 })
414 414
415 it('Should not auto blacklist a video on upload if the user has the bypass blacklist flag', async function () { 415 it('Should not auto blacklist a video on upload if the user has the bypass blacklist flag', async function () {
416 await servers[0].videosCommand.upload({ token: userWithFlag, attributes: { name: 'not blacklisted' } }) 416 await servers[0].videos.upload({ token: userWithFlag, attributes: { name: 'not blacklisted' } })
417 417
418 const body = await command.list({ type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED }) 418 const body = await command.list({ type: VideoBlacklistType.AUTO_BEFORE_PUBLISHED })
419 expect(body.total).to.equal(3) 419 expect(body.total).to.equal(3)