From c5d31dba56d669c0df0209761c43c5a6ac7cec4a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 28 Dec 2017 13:59:22 +0100 Subject: Tests directories refractor --- server/tests/utils/videos/video-abuses.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 server/tests/utils/videos/video-abuses.ts (limited to 'server/tests/utils/videos/video-abuses.ts') diff --git a/server/tests/utils/videos/video-abuses.ts b/server/tests/utils/videos/video-abuses.ts new file mode 100644 index 000000000..f00809234 --- /dev/null +++ b/server/tests/utils/videos/video-abuses.ts @@ -0,0 +1,31 @@ +import * as request from 'supertest' + +function reportVideoAbuse (url: string, token: string, videoId: number, reason: string, specialStatus = 204) { + const path = '/api/v1/videos/' + videoId + '/abuse' + + return request(url) + .post(path) + .set('Accept', 'application/json') + .set('Authorization', 'Bearer ' + token) + .send({ reason }) + .expect(specialStatus) +} + +function getVideoAbusesList (url: string, token: string) { + const path = '/api/v1/videos/abuse' + + return request(url) + .get(path) + .query({ sort: 'createdAt' }) + .set('Accept', 'application/json') + .set('Authorization', 'Bearer ' + token) + .expect(200) + .expect('Content-Type', /json/) +} + +// --------------------------------------------------------------------------- + +export { + reportVideoAbuse, + getVideoAbusesList +} -- cgit v1.2.3