X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fcheck-params%2Fvideo-comments.ts;h=c21aebaaea92762e34e075bce9b423ed005e76e9;hb=41d1d075011174e73dccb74006181a92a618d7b4;hp=a38420851f8d109b394898a7ad9539755b69a1c4;hpb=d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts index a38420851..c21aebaae 100644 --- a/server/tests/api/check-params/video-comments.ts +++ b/server/tests/api/check-params/video-comments.ts @@ -2,9 +2,11 @@ import 'mocha' import * as chai from 'chai' -import { VideoCreateResult } from '@shared/models' -import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' +import { HttpStatusCode } from '@shared/core-utils' import { + checkBadCountPagination, + checkBadSortPagination, + checkBadStartPagination, cleanupTests, createUser, flushAndRunServer, @@ -13,15 +15,9 @@ import { makePostBodyRequest, ServerInfo, setAccessTokensToServers, - uploadVideo, - userLogin -} from '../../../../shared/extra-utils' -import { - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination -} from '../../../../shared/extra-utils/requests/check-api-params' -import { addVideoCommentThread } from '../../../../shared/extra-utils/videos/video-comments' + uploadVideo +} from '@shared/extra-utils' +import { VideoCreateResult } from '@shared/models' const expect = chai.expect @@ -50,21 +46,21 @@ describe('Test video comments API validator', function () { } { - const res = await addVideoCommentThread(server.url, server.accessToken, video.uuid, 'coucou') - commentId = res.body.comment.id + const created = await server.commentsCommand.createThread({ videoId: video.uuid, text: 'coucou' }) + commentId = created.id pathComment = '/api/v1/videos/' + video.uuid + '/comments/' + commentId } { const user = { username: 'user1', password: 'my super password' } await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) - userAccessToken = await userLogin(server, user) + userAccessToken = await server.loginCommand.getAccessToken(user) } { const user = { username: 'user2', password: 'my super password' } await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) - userAccessToken2 = await userLogin(server, user) + userAccessToken2 = await server.loginCommand.getAccessToken(user) } }) @@ -281,8 +277,8 @@ describe('Test video comments API validator', function () { let commentToDelete: number { - const res = await addVideoCommentThread(server.url, userAccessToken, video.uuid, 'hello') - commentToDelete = res.body.comment.id + const created = await server.commentsCommand.createThread({ videoId: video.uuid, token: userAccessToken, text: 'hello' }) + commentToDelete = created.id } const path = '/api/v1/videos/' + video.uuid + '/comments/' + commentToDelete @@ -301,8 +297,8 @@ describe('Test video comments API validator', function () { } { - const res = await addVideoCommentThread(server.url, server.accessToken, anotherVideoUUID, 'hello') - commentToDelete = res.body.comment.id + const created = await server.commentsCommand.createThread({ videoId: anotherVideoUUID, text: 'hello' }) + commentToDelete = created.id } const path = '/api/v1/videos/' + anotherVideoUUID + '/comments/' + commentToDelete