moderation-notifications.ts 23 KB

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