aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params
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/check-params
parenta54618880c394ad7571f3f3222dc96ec2dd10d9a (diff)
downloadPeerTube-12edc1495a36b2199f1bf1ba37f50c7b694be382.tar.gz
PeerTube-12edc1495a36b2199f1bf1ba37f50c7b694be382.tar.zst
PeerTube-12edc1495a36b2199f1bf1ba37f50c7b694be382.zip
Introduce comments command
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r--server/tests/api/check-params/video-comments.ts27
1 files changed, 12 insertions, 15 deletions
diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts
index a38420851..ff94645cb 100644
--- a/server/tests/api/check-params/video-comments.ts
+++ b/server/tests/api/check-params/video-comments.ts
@@ -2,9 +2,11 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { VideoCreateResult } from '@shared/models' 5import { HttpStatusCode } from '@shared/core-utils'
6import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
7import { 6import {
7 checkBadCountPagination,
8 checkBadSortPagination,
9 checkBadStartPagination,
8 cleanupTests, 10 cleanupTests,
9 createUser, 11 createUser,
10 flushAndRunServer, 12 flushAndRunServer,
@@ -15,13 +17,8 @@ import {
15 setAccessTokensToServers, 17 setAccessTokensToServers,
16 uploadVideo, 18 uploadVideo,
17 userLogin 19 userLogin
18} from '../../../../shared/extra-utils' 20} from '@shared/extra-utils'
19import { 21import { VideoCreateResult } from '@shared/models'
20 checkBadCountPagination,
21 checkBadSortPagination,
22 checkBadStartPagination
23} from '../../../../shared/extra-utils/requests/check-api-params'
24import { addVideoCommentThread } from '../../../../shared/extra-utils/videos/video-comments'
25 22
26const expect = chai.expect 23const expect = chai.expect
27 24
@@ -50,8 +47,8 @@ describe('Test video comments API validator', function () {
50 } 47 }
51 48
52 { 49 {
53 const res = await addVideoCommentThread(server.url, server.accessToken, video.uuid, 'coucou') 50 const created = await server.commentsCommand.createThread({ videoId: video.uuid, text: 'coucou' })
54 commentId = res.body.comment.id 51 commentId = created.id
55 pathComment = '/api/v1/videos/' + video.uuid + '/comments/' + commentId 52 pathComment = '/api/v1/videos/' + video.uuid + '/comments/' + commentId
56 } 53 }
57 54
@@ -281,8 +278,8 @@ describe('Test video comments API validator', function () {
281 let commentToDelete: number 278 let commentToDelete: number
282 279
283 { 280 {
284 const res = await addVideoCommentThread(server.url, userAccessToken, video.uuid, 'hello') 281 const created = await server.commentsCommand.createThread({ videoId: video.uuid, text: 'hello' })
285 commentToDelete = res.body.comment.id 282 commentToDelete = created.id
286 } 283 }
287 284
288 const path = '/api/v1/videos/' + video.uuid + '/comments/' + commentToDelete 285 const path = '/api/v1/videos/' + video.uuid + '/comments/' + commentToDelete
@@ -301,8 +298,8 @@ describe('Test video comments API validator', function () {
301 } 298 }
302 299
303 { 300 {
304 const res = await addVideoCommentThread(server.url, server.accessToken, anotherVideoUUID, 'hello') 301 const created = await server.commentsCommand.createThread({ videoId: anotherVideoUUID, text: 'hello' })
305 commentToDelete = res.body.comment.id 302 commentToDelete = created.id
306 } 303 }
307 304
308 const path = '/api/v1/videos/' + anotherVideoUUID + '/comments/' + commentToDelete 305 const path = '/api/v1/videos/' + anotherVideoUUID + '/comments/' + commentToDelete