moderation-notifications.ts 23 KB

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