]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/tests/api/notifications/moderation-notifications.ts
Introduce accounts command
[github/Chocobozzz/PeerTube.git] / server / tests / api / notifications / moderation-notifications.ts
CommitLineData
8eb07b01
C
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2
3import 'mocha'
d4a8e7a6 4import { buildUUID } from '@server/helpers/uuid'
8eb07b01 5import {
0c1a77e9 6 addUserSubscription,
310b5219 7 addVideoCommentThread,
8eb07b01 8 addVideoToBlacklist,
0c1a77e9
C
9 checkAbuseStateChange,
10 checkAutoInstanceFollowing,
11 CheckerBaseParams,
12 checkNewAbuseMessage,
13 checkNewAccountAbuseForModerators,
14 checkNewBlacklistOnMyVideo,
15 checkNewCommentAbuseForModerators,
16 checkNewInstanceFollower,
17 checkNewVideoAbuseForModerators,
18 checkNewVideoFromSubscription,
19 checkUserRegistered,
20 checkVideoAutoBlacklistForModerators,
21 checkVideoIsPublished,
8eb07b01 22 cleanupTests,
310b5219 23 createUser,
310b5219 24 generateUserAccessToken,
310b5219
C
25 getVideoCommentThreads,
26 getVideoIdFromUUID,
8eb07b01
C
27 immutableAssign,
28 MockInstancesIndex,
0c1a77e9
C
29 MockSmtpServer,
30 prepareNotificationsTest,
8eb07b01 31 registerUser,
0c1a77e9 32 removeUserSubscription,
8eb07b01 33 removeVideoFromBlacklist,
0c1a77e9 34 ServerInfo,
0c1a77e9
C
35 uploadVideo,
36 wait,
37 waitJobs
38} from '@shared/extra-utils'
39import { AbuseState, CustomConfig, UserNotification, VideoPrivacy } from '@shared/models'
8eb07b01
C
40
41describe('Test moderation notifications', function () {
42 let servers: ServerInfo[] = []
43 let userAccessToken: string
44 let userNotifications: UserNotification[] = []
45 let adminNotifications: UserNotification[] = []
46 let adminNotificationsServer2: UserNotification[] = []
47 let emails: object[] = []
48
49 before(async function () {
50 this.timeout(120000)
51
52 const res = await prepareNotificationsTest(3)
53 emails = res.emails
54 userAccessToken = res.userAccessToken
55 servers = res.servers
56 userNotifications = res.userNotifications
57 adminNotifications = res.adminNotifications
58 adminNotificationsServer2 = res.adminNotificationsServer2
59 })
60
594d3e48 61 describe('Abuse for moderators notification', function () {
8eb07b01
C
62 let baseParams: CheckerBaseParams
63
64 before(() => {
65 baseParams = {
66 server: servers[0],
67 emails,
68 socketNotifications: adminNotifications,
69 token: servers[0].accessToken
70 }
71 })
72
73 it('Should send a notification to moderators on local video abuse', async function () {
20516920 74 this.timeout(20000)
8eb07b01 75
d4a8e7a6 76 const name = 'video for abuse ' + buildUUID()
8eb07b01 77 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
4f32032f 78 const video = resVideo.body.video
8eb07b01 79
0c1a77e9 80 await servers[0].abusesCommand.report({ videoId: video.id, reason: 'super reason' })
8eb07b01
C
81
82 await waitJobs(servers)
4f32032f 83 await checkNewVideoAbuseForModerators(baseParams, video.uuid, name, 'presence')
8eb07b01
C
84 })
85
86 it('Should send a notification to moderators on remote video abuse', async function () {
20516920 87 this.timeout(20000)
8eb07b01 88
d4a8e7a6 89 const name = 'video for abuse ' + buildUUID()
8eb07b01 90 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
4f32032f 91 const video = resVideo.body.video
8eb07b01
C
92
93 await waitJobs(servers)
94
310b5219 95 const videoId = await getVideoIdFromUUID(servers[1].url, video.uuid)
0c1a77e9 96 await servers[1].abusesCommand.report({ videoId, reason: 'super reason' })
8eb07b01
C
97
98 await waitJobs(servers)
4f32032f 99 await checkNewVideoAbuseForModerators(baseParams, video.uuid, name, 'presence')
8eb07b01 100 })
310b5219
C
101
102 it('Should send a notification to moderators on local comment abuse', async function () {
20516920 103 this.timeout(20000)
310b5219 104
d4a8e7a6 105 const name = 'video for abuse ' + buildUUID()
310b5219
C
106 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
107 const video = resVideo.body.video
d4a8e7a6 108 const resComment = await addVideoCommentThread(servers[0].url, userAccessToken, video.id, 'comment abuse ' + buildUUID())
310b5219
C
109 const comment = resComment.body.comment
110
15bedeeb
C
111 await waitJobs(servers)
112
0c1a77e9 113 await servers[0].abusesCommand.report({ commentId: comment.id, reason: 'super reason' })
310b5219
C
114
115 await waitJobs(servers)
116 await checkNewCommentAbuseForModerators(baseParams, video.uuid, name, 'presence')
117 })
118
119 it('Should send a notification to moderators on remote comment abuse', async function () {
20516920 120 this.timeout(20000)
310b5219 121
d4a8e7a6 122 const name = 'video for abuse ' + buildUUID()
310b5219
C
123 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
124 const video = resVideo.body.video
d4a8e7a6 125 await addVideoCommentThread(servers[0].url, userAccessToken, video.id, 'comment abuse ' + buildUUID())
310b5219
C
126
127 await waitJobs(servers)
128
129 const resComments = await getVideoCommentThreads(servers[1].url, video.uuid, 0, 5)
130 const commentId = resComments.body.data[0].id
0c1a77e9 131 await servers[1].abusesCommand.report({ commentId, reason: 'super reason' })
310b5219
C
132
133 await waitJobs(servers)
134 await checkNewCommentAbuseForModerators(baseParams, video.uuid, name, 'presence')
135 })
136
137 it('Should send a notification to moderators on local account abuse', async function () {
20516920 138 this.timeout(20000)
310b5219
C
139
140 const username = 'user' + new Date().getTime()
141 const resUser = await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username, password: 'donald' })
142 const accountId = resUser.body.user.account.id
143
0c1a77e9 144 await servers[0].abusesCommand.report({ accountId, reason: 'super reason' })
310b5219
C
145
146 await waitJobs(servers)
147 await checkNewAccountAbuseForModerators(baseParams, username, 'presence')
148 })
149
150 it('Should send a notification to moderators on remote account abuse', async function () {
20516920 151 this.timeout(20000)
310b5219
C
152
153 const username = 'user' + new Date().getTime()
154 const tmpToken = await generateUserAccessToken(servers[0], username)
155 await uploadVideo(servers[0].url, tmpToken, { name: 'super video' })
156
157 await waitJobs(servers)
158
9fff08cf
C
159 const account = await servers[1].accountsCommand.get({ accountName: username + '@' + servers[0].host })
160 await servers[1].abusesCommand.report({ accountId: account.id, reason: 'super reason' })
310b5219
C
161
162 await waitJobs(servers)
163 await checkNewAccountAbuseForModerators(baseParams, username, 'presence')
164 })
8eb07b01
C
165 })
166
594d3e48
C
167 describe('Abuse state change notification', function () {
168 let baseParams: CheckerBaseParams
169 let abuseId: number
170
171 before(async function () {
172 baseParams = {
173 server: servers[0],
174 emails,
175 socketNotifications: userNotifications,
176 token: userAccessToken
177 }
178
d4a8e7a6 179 const name = 'abuse ' + buildUUID()
594d3e48
C
180 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
181 const video = resVideo.body.video
182
0c1a77e9
C
183 const body = await servers[0].abusesCommand.report({ token: userAccessToken, videoId: video.id, reason: 'super reason' })
184 abuseId = body.abuse.id
594d3e48
C
185 })
186
187 it('Should send a notification to reporter if the abuse has been accepted', async function () {
188 this.timeout(10000)
189
0c1a77e9 190 await servers[0].abusesCommand.update({ abuseId, body: { state: AbuseState.ACCEPTED } })
594d3e48
C
191 await waitJobs(servers)
192
193 await checkAbuseStateChange(baseParams, abuseId, AbuseState.ACCEPTED, 'presence')
194 })
195
196 it('Should send a notification to reporter if the abuse has been rejected', async function () {
197 this.timeout(10000)
198
0c1a77e9 199 await servers[0].abusesCommand.update({ abuseId, body: { state: AbuseState.REJECTED } })
594d3e48
C
200 await waitJobs(servers)
201
202 await checkAbuseStateChange(baseParams, abuseId, AbuseState.REJECTED, 'presence')
203 })
204 })
205
206 describe('New abuse message notification', function () {
207 let baseParamsUser: CheckerBaseParams
208 let baseParamsAdmin: CheckerBaseParams
209 let abuseId: number
210 let abuseId2: number
211
212 before(async function () {
213 baseParamsUser = {
214 server: servers[0],
215 emails,
216 socketNotifications: userNotifications,
217 token: userAccessToken
218 }
219
220 baseParamsAdmin = {
221 server: servers[0],
222 emails,
223 socketNotifications: adminNotifications,
224 token: servers[0].accessToken
225 }
226
d4a8e7a6 227 const name = 'abuse ' + buildUUID()
594d3e48
C
228 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
229 const video = resVideo.body.video
230
231 {
2d1ad5b9 232 const body = await servers[0].abusesCommand.report({ token: userAccessToken, videoId: video.id, reason: 'super reason' })
0c1a77e9 233 abuseId = body.abuse.id
594d3e48
C
234 }
235
236 {
0c1a77e9
C
237 const body = await servers[0].abusesCommand.report({ token: userAccessToken, videoId: video.id, reason: 'super reason 2' })
238 abuseId2 = body.abuse.id
594d3e48
C
239 }
240 })
241
242 it('Should send a notification to reporter on new message', async function () {
243 this.timeout(10000)
244
245 const message = 'my super message to users'
0c1a77e9 246 await servers[0].abusesCommand.addMessage({ abuseId, message })
594d3e48
C
247 await waitJobs(servers)
248
249 await checkNewAbuseMessage(baseParamsUser, abuseId, message, 'user_1@example.com', 'presence')
250 })
251
252 it('Should not send a notification to the admin if sent by the admin', async function () {
253 this.timeout(10000)
254
255 const message = 'my super message that should not be sent to the admin'
0c1a77e9 256 await servers[0].abusesCommand.addMessage({ abuseId, message })
594d3e48
C
257 await waitJobs(servers)
258
41130b4c 259 await checkNewAbuseMessage(baseParamsAdmin, abuseId, message, 'admin' + servers[0].internalServerNumber + '@example.com', 'absence')
594d3e48
C
260 })
261
262 it('Should send a notification to moderators', async function () {
263 this.timeout(10000)
264
265 const message = 'my super message to moderators'
0c1a77e9 266 await servers[0].abusesCommand.addMessage({ token: userAccessToken, abuseId: abuseId2, message })
594d3e48
C
267 await waitJobs(servers)
268
41130b4c 269 await checkNewAbuseMessage(baseParamsAdmin, abuseId2, message, 'admin' + servers[0].internalServerNumber + '@example.com', 'presence')
594d3e48
C
270 })
271
272 it('Should not send a notification to reporter if sent by the reporter', async function () {
273 this.timeout(10000)
274
275 const message = 'my super message that should not be sent to reporter'
0c1a77e9 276 await servers[0].abusesCommand.addMessage({ token: userAccessToken, abuseId: abuseId2, message })
594d3e48
C
277 await waitJobs(servers)
278
279 await checkNewAbuseMessage(baseParamsUser, abuseId2, message, 'user_1@example.com', 'absence')
280 })
281 })
282
8eb07b01
C
283 describe('Video blacklist on my video', function () {
284 let baseParams: CheckerBaseParams
285
286 before(() => {
287 baseParams = {
288 server: servers[0],
289 emails,
290 socketNotifications: userNotifications,
291 token: userAccessToken
292 }
293 })
294
295 it('Should send a notification to video owner on blacklist', async function () {
296 this.timeout(10000)
297
d4a8e7a6 298 const name = 'video for abuse ' + buildUUID()
8eb07b01
C
299 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
300 const uuid = resVideo.body.video.uuid
301
302 await addVideoToBlacklist(servers[0].url, servers[0].accessToken, uuid)
303
304 await waitJobs(servers)
305 await checkNewBlacklistOnMyVideo(baseParams, uuid, name, 'blacklist')
306 })
307
308 it('Should send a notification to video owner on unblacklist', async function () {
309 this.timeout(10000)
310
d4a8e7a6 311 const name = 'video for abuse ' + buildUUID()
8eb07b01
C
312 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
313 const uuid = resVideo.body.video.uuid
314
315 await addVideoToBlacklist(servers[0].url, servers[0].accessToken, uuid)
316
317 await waitJobs(servers)
318 await removeVideoFromBlacklist(servers[0].url, servers[0].accessToken, uuid)
319 await waitJobs(servers)
320
321 await wait(500)
322 await checkNewBlacklistOnMyVideo(baseParams, uuid, name, 'unblacklist')
323 })
324 })
325
326 describe('New registration', function () {
327 let baseParams: CheckerBaseParams
328
329 before(() => {
330 baseParams = {
331 server: servers[0],
332 emails,
333 socketNotifications: adminNotifications,
334 token: servers[0].accessToken
335 }
336 })
337
338 it('Should send a notification only to moderators when a user registers on the instance', async function () {
339 this.timeout(10000)
340
341 await registerUser(servers[0].url, 'user_45', 'password')
342
343 await waitJobs(servers)
344
345 await checkUserRegistered(baseParams, 'user_45', 'presence')
346
347 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } }
348 await checkUserRegistered(immutableAssign(baseParams, userOverride), 'user_45', 'absence')
349 })
350 })
351
352 describe('New instance follows', function () {
353 const instanceIndexServer = new MockInstancesIndex()
f6500729 354 let config: any
8eb07b01
C
355 let baseParams: CheckerBaseParams
356
357 before(async () => {
358 baseParams = {
359 server: servers[0],
360 emails,
361 socketNotifications: adminNotifications,
362 token: servers[0].accessToken
363 }
364
f6500729 365 const port = await instanceIndexServer.initialize()
8eb07b01 366 instanceIndexServer.addInstance(servers[1].host)
f6500729
C
367
368 config = {
369 followings: {
370 instance: {
371 autoFollowIndex: {
372 indexUrl: `http://localhost:${port}/api/v1/instances/hosts`,
373 enabled: true
374 }
375 }
376 }
377 }
8eb07b01
C
378 })
379
380 it('Should send a notification only to admin when there is a new instance follower', async function () {
381 this.timeout(20000)
382
c3d29f69 383 await servers[2].followsCommand.follow({ targets: [ servers[0].url ] })
8eb07b01
C
384
385 await waitJobs(servers)
386
387 await checkNewInstanceFollower(baseParams, 'localhost:' + servers[2].port, 'presence')
388
389 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } }
390 await checkNewInstanceFollower(immutableAssign(baseParams, userOverride), 'localhost:' + servers[2].port, 'absence')
391 })
392
393 it('Should send a notification on auto follow back', async function () {
394 this.timeout(40000)
395
c3d29f69 396 await servers[2].followsCommand.unfollow({ target: servers[0] })
8eb07b01
C
397 await waitJobs(servers)
398
399 const config = {
400 followings: {
401 instance: {
402 autoFollowBack: { enabled: true }
403 }
404 }
405 }
65e6e260 406 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
8eb07b01 407
c3d29f69 408 await servers[2].followsCommand.follow({ targets: [ servers[0].url ] })
8eb07b01
C
409
410 await waitJobs(servers)
411
412 const followerHost = servers[0].host
413 const followingHost = servers[2].host
414 await checkAutoInstanceFollowing(baseParams, followerHost, followingHost, 'presence')
415
416 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } }
417 await checkAutoInstanceFollowing(immutableAssign(baseParams, userOverride), followerHost, followingHost, 'absence')
418
419 config.followings.instance.autoFollowBack.enabled = false
65e6e260 420 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
c3d29f69
C
421 await servers[0].followsCommand.unfollow({ target: servers[2] })
422 await servers[2].followsCommand.unfollow({ target: servers[0] })
8eb07b01
C
423 })
424
425 it('Should send a notification on auto instances index follow', async function () {
426 this.timeout(30000)
c3d29f69 427 await servers[0].followsCommand.unfollow({ target: servers[1] })
8eb07b01 428
65e6e260 429 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
8eb07b01
C
430
431 await wait(5000)
432 await waitJobs(servers)
433
434 const followerHost = servers[0].host
435 const followingHost = servers[1].host
436 await checkAutoInstanceFollowing(baseParams, followerHost, followingHost, 'presence')
437
438 config.followings.instance.autoFollowIndex.enabled = false
65e6e260 439 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
c3d29f69 440 await servers[0].followsCommand.unfollow({ target: servers[1] })
8eb07b01
C
441 })
442 })
443
444 describe('Video-related notifications when video auto-blacklist is enabled', function () {
445 let userBaseParams: CheckerBaseParams
446 let adminBaseParamsServer1: CheckerBaseParams
447 let adminBaseParamsServer2: CheckerBaseParams
448 let videoUUID: string
449 let videoName: string
450 let currentCustomConfig: CustomConfig
451
452 before(async () => {
453
454 adminBaseParamsServer1 = {
455 server: servers[0],
456 emails,
457 socketNotifications: adminNotifications,
458 token: servers[0].accessToken
459 }
460
461 adminBaseParamsServer2 = {
462 server: servers[1],
463 emails,
464 socketNotifications: adminNotificationsServer2,
465 token: servers[1].accessToken
466 }
467
468 userBaseParams = {
469 server: servers[0],
470 emails,
471 socketNotifications: userNotifications,
472 token: userAccessToken
473 }
474
65e6e260
C
475 currentCustomConfig = await servers[0].configCommand.getCustomConfig()
476
8eb07b01
C
477 const autoBlacklistTestsCustomConfig = immutableAssign(currentCustomConfig, {
478 autoBlacklist: {
479 videos: {
480 ofUsers: {
481 enabled: true
482 }
483 }
484 }
485 })
65e6e260 486
8eb07b01
C
487 // enable transcoding otherwise own publish notification after transcoding not expected
488 autoBlacklistTestsCustomConfig.transcoding.enabled = true
65e6e260 489 await servers[0].configCommand.updateCustomConfig({ newCustomConfig: autoBlacklistTestsCustomConfig })
8eb07b01
C
490
491 await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port)
492 await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port)
493
494 })
495
496 it('Should send notification to moderators on new video with auto-blacklist', async function () {
34caef7f 497 this.timeout(40000)
8eb07b01 498
d4a8e7a6 499 videoName = 'video with auto-blacklist ' + buildUUID()
8eb07b01
C
500 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name: videoName })
501 videoUUID = resVideo.body.video.uuid
502
503 await waitJobs(servers)
504 await checkVideoAutoBlacklistForModerators(adminBaseParamsServer1, videoUUID, videoName, 'presence')
505 })
506
507 it('Should not send video publish notification if auto-blacklisted', async function () {
508 await checkVideoIsPublished(userBaseParams, videoName, videoUUID, 'absence')
509 })
510
511 it('Should not send a local user subscription notification if auto-blacklisted', async function () {
512 await checkNewVideoFromSubscription(adminBaseParamsServer1, videoName, videoUUID, 'absence')
513 })
514
515 it('Should not send a remote user subscription notification if auto-blacklisted', async function () {
516 await checkNewVideoFromSubscription(adminBaseParamsServer2, videoName, videoUUID, 'absence')
517 })
518
519 it('Should send video published and unblacklist after video unblacklisted', async function () {
34caef7f 520 this.timeout(40000)
8eb07b01
C
521
522 await removeVideoFromBlacklist(servers[0].url, servers[0].accessToken, videoUUID)
523
524 await waitJobs(servers)
525
526 // FIXME: Can't test as two notifications sent to same user and util only checks last one
527 // One notification might be better anyways
528 // await checkNewBlacklistOnMyVideo(userBaseParams, videoUUID, videoName, 'unblacklist')
529 // await checkVideoIsPublished(userBaseParams, videoName, videoUUID, 'presence')
530 })
531
532 it('Should send a local user subscription notification after removed from blacklist', async function () {
533 await checkNewVideoFromSubscription(adminBaseParamsServer1, videoName, videoUUID, 'presence')
534 })
535
536 it('Should send a remote user subscription notification after removed from blacklist', async function () {
537 await checkNewVideoFromSubscription(adminBaseParamsServer2, videoName, videoUUID, 'presence')
538 })
539
540 it('Should send unblacklist but not published/subscription notes after unblacklisted if scheduled update pending', async function () {
59fd824c 541 this.timeout(40000)
8eb07b01
C
542
543 const updateAt = new Date(new Date().getTime() + 1000000)
544
d4a8e7a6 545 const name = 'video with auto-blacklist and future schedule ' + buildUUID()
8eb07b01
C
546
547 const data = {
548 name,
549 privacy: VideoPrivacy.PRIVATE,
550 scheduleUpdate: {
551 updateAt: updateAt.toISOString(),
552 privacy: VideoPrivacy.PUBLIC
553 }
554 }
555
556 const resVideo = await uploadVideo(servers[0].url, userAccessToken, data)
557 const uuid = resVideo.body.video.uuid
558
559 await removeVideoFromBlacklist(servers[0].url, servers[0].accessToken, uuid)
560
561 await waitJobs(servers)
562 await checkNewBlacklistOnMyVideo(userBaseParams, uuid, name, 'unblacklist')
563
564 // FIXME: Can't test absence as two notifications sent to same user and util only checks last one
565 // One notification might be better anyways
566 // await checkVideoIsPublished(userBaseParams, name, uuid, 'absence')
567
568 await checkNewVideoFromSubscription(adminBaseParamsServer1, name, uuid, 'absence')
569 await checkNewVideoFromSubscription(adminBaseParamsServer2, name, uuid, 'absence')
570 })
571
572 it('Should not send publish/subscription notifications after scheduled update if video still auto-blacklisted', async function () {
59fd824c 573 this.timeout(40000)
8eb07b01
C
574
575 // In 2 seconds
576 const updateAt = new Date(new Date().getTime() + 2000)
577
d4a8e7a6 578 const name = 'video with schedule done and still auto-blacklisted ' + buildUUID()
8eb07b01
C
579
580 const data = {
581 name,
582 privacy: VideoPrivacy.PRIVATE,
583 scheduleUpdate: {
584 updateAt: updateAt.toISOString(),
585 privacy: VideoPrivacy.PUBLIC
586 }
587 }
588
589 const resVideo = await uploadVideo(servers[0].url, userAccessToken, data)
590 const uuid = resVideo.body.video.uuid
591
592 await wait(6000)
593 await checkVideoIsPublished(userBaseParams, name, uuid, 'absence')
594 await checkNewVideoFromSubscription(adminBaseParamsServer1, name, uuid, 'absence')
595 await checkNewVideoFromSubscription(adminBaseParamsServer2, name, uuid, 'absence')
596 })
597
598 it('Should not send a notification to moderators on new video without auto-blacklist', async function () {
26171379 599 this.timeout(60000)
8eb07b01 600
d4a8e7a6 601 const name = 'video without auto-blacklist ' + buildUUID()
8eb07b01
C
602
603 // admin with blacklist right will not be auto-blacklisted
604 const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name })
605 const uuid = resVideo.body.video.uuid
606
607 await waitJobs(servers)
608 await checkVideoAutoBlacklistForModerators(adminBaseParamsServer1, uuid, name, 'absence')
609 })
610
611 after(async () => {
65e6e260 612 await servers[0].configCommand.updateCustomConfig({ newCustomConfig: currentCustomConfig })
8eb07b01
C
613
614 await removeUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port)
615 await removeUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port)
616 })
617 })
618
619 after(async function () {
620 MockSmtpServer.Instance.kill()
621
622 await cleanupTests(servers)
623 })
624})