+ it('Should succeed with the same user', async function () {
+ let commentToDelete: number
+
+ {
+ const res = await addVideoCommentThread(server.url, userAccessToken, videoUUID, 'hello')
+ commentToDelete = res.body.comment.id
+ }
+
+ const path = '/api/v1/videos/' + videoUUID + '/comments/' + commentToDelete
+
+ await makeDeleteRequest({ url: server.url, path, token: userAccessToken2, statusCodeExpected: 403 })
+ await makeDeleteRequest({ url: server.url, path, token: userAccessToken, statusCodeExpected: 204 })
+ })
+
+ it('Should succeed with the owner of the video', async function () {
+ let commentToDelete: number
+ let anotherVideoUUID: string
+
+ {
+ const res = await uploadVideo(server.url, userAccessToken, { name: 'video' })
+ anotherVideoUUID = res.body.video.uuid
+ }
+
+ {
+ const res = await addVideoCommentThread(server.url, server.accessToken, anotherVideoUUID, 'hello')
+ commentToDelete = res.body.comment.id
+ }
+
+ const path = '/api/v1/videos/' + anotherVideoUUID + '/comments/' + commentToDelete
+
+ await makeDeleteRequest({ url: server.url, path, token: userAccessToken2, statusCodeExpected: 403 })
+ await makeDeleteRequest({ url: server.url, path, token: userAccessToken, statusCodeExpected: 204 })
+ })
+