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