From 7ad9b9846c44d198a736183fb186c2039f5236b5 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 12 Oct 2018 15:26:04 +0200 Subject: Add ability for users to block an account/instance on server side --- server/tests/utils/videos/video-comments.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'server/tests/utils/videos') diff --git a/server/tests/utils/videos/video-comments.ts b/server/tests/utils/videos/video-comments.ts index 1b9ee452e..7d4cae364 100644 --- a/server/tests/utils/videos/video-comments.ts +++ b/server/tests/utils/videos/video-comments.ts @@ -1,7 +1,7 @@ import * as request from 'supertest' import { makeDeleteRequest } from '../' -function getVideoCommentThreads (url: string, videoId: number | string, start: number, count: number, sort?: string) { +function getVideoCommentThreads (url: string, videoId: number | string, start: number, count: number, sort?: string, token?: string) { const path = '/api/v1/videos/' + videoId + '/comment-threads' const req = request(url) @@ -10,20 +10,24 @@ function getVideoCommentThreads (url: string, videoId: number | string, start: n .query({ count: count }) if (sort) req.query({ sort }) + if (token) req.set('Authorization', 'Bearer ' + token) return req.set('Accept', 'application/json') .expect(200) .expect('Content-Type', /json/) } -function getVideoThreadComments (url: string, videoId: number | string, threadId: number) { +function getVideoThreadComments (url: string, videoId: number | string, threadId: number, token?: string) { const path = '/api/v1/videos/' + videoId + '/comment-threads/' + threadId - return request(url) + const req = request(url) .get(path) .set('Accept', 'application/json') - .expect(200) - .expect('Content-Type', /json/) + + if (token) req.set('Authorization', 'Bearer ' + token) + + return req.expect(200) + .expect('Content-Type', /json/) } function addVideoCommentThread (url: string, token: string, videoId: number | string, text: string, expectedStatus = 200) { -- cgit v1.2.3