aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/notifications/moderation-notifications.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-09 14:15:11 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit12edc1495a36b2199f1bf1ba37f50c7b694be382 (patch)
tree3abfe2e5b54076de73fbfa25386d0313fc3b7242 /server/tests/api/notifications/moderation-notifications.ts
parenta54618880c394ad7571f3f3222dc96ec2dd10d9a (diff)
downloadPeerTube-12edc1495a36b2199f1bf1ba37f50c7b694be382.tar.gz
PeerTube-12edc1495a36b2199f1bf1ba37f50c7b694be382.tar.zst
PeerTube-12edc1495a36b2199f1bf1ba37f50c7b694be382.zip
Introduce comments command
Diffstat (limited to 'server/tests/api/notifications/moderation-notifications.ts')
-rw-r--r--server/tests/api/notifications/moderation-notifications.ts20
1 files changed, 13 insertions, 7 deletions
diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts
index 52ade0548..229f78811 100644
--- a/server/tests/api/notifications/moderation-notifications.ts
+++ b/server/tests/api/notifications/moderation-notifications.ts
@@ -3,7 +3,6 @@
3import 'mocha' 3import 'mocha'
4import { buildUUID } from '@server/helpers/uuid' 4import { buildUUID } from '@server/helpers/uuid'
5import { 5import {
6 addVideoCommentThread,
7 checkAbuseStateChange, 6 checkAbuseStateChange,
8 checkAutoInstanceFollowing, 7 checkAutoInstanceFollowing,
9 CheckerBaseParams, 8 CheckerBaseParams,
@@ -20,7 +19,6 @@ import {
20 cleanupTests, 19 cleanupTests,
21 createUser, 20 createUser,
22 generateUserAccessToken, 21 generateUserAccessToken,
23 getVideoCommentThreads,
24 getVideoIdFromUUID, 22 getVideoIdFromUUID,
25 immutableAssign, 23 immutableAssign,
26 MockInstancesIndex, 24 MockInstancesIndex,
@@ -101,8 +99,11 @@ describe('Test moderation notifications', function () {
101 const name = 'video for abuse ' + buildUUID() 99 const name = 'video for abuse ' + buildUUID()
102 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name }) 100 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
103 const video = resVideo.body.video 101 const video = resVideo.body.video
104 const resComment = await addVideoCommentThread(servers[0].url, userAccessToken, video.id, 'comment abuse ' + buildUUID()) 102 const comment = await servers[0].commentsCommand.createThread({
105 const comment = resComment.body.comment 103 token: userAccessToken,
104 videoId: video.id,
105 text: 'comment abuse ' + buildUUID()
106 })
106 107
107 await waitJobs(servers) 108 await waitJobs(servers)
108 109
@@ -118,12 +119,17 @@ describe('Test moderation notifications', function () {
118 const name = 'video for abuse ' + buildUUID() 119 const name = 'video for abuse ' + buildUUID()
119 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name }) 120 const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name })
120 const video = resVideo.body.video 121 const video = resVideo.body.video
121 await addVideoCommentThread(servers[0].url, userAccessToken, video.id, 'comment abuse ' + buildUUID()) 122
123 await servers[0].commentsCommand.createThread({
124 token: userAccessToken,
125 videoId: video.id,
126 text: 'comment abuse ' + buildUUID()
127 })
122 128
123 await waitJobs(servers) 129 await waitJobs(servers)
124 130
125 const resComments = await getVideoCommentThreads(servers[1].url, video.uuid, 0, 5) 131 const { data } = await servers[1].commentsCommand.listThreads({ videoId: video.uuid })
126 const commentId = resComments.body.data[0].id 132 const commentId = data[0].id
127 await servers[1].abusesCommand.report({ commentId, reason: 'super reason' }) 133 await servers[1].abusesCommand.report({ commentId, reason: 'super reason' })
128 134
129 await waitJobs(servers) 135 await waitJobs(servers)