From 843aa7ba0312e7180e7bbae147e32ee60e70d9ba Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 1 May 2017 19:04:29 +0200 Subject: Server: add tests for video blacklists --- server/tests/utils/video-abuses.js | 4 ++-- server/tests/utils/video-blacklists.js | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 server/tests/utils/video-blacklists.js (limited to 'server/tests/utils') diff --git a/server/tests/utils/video-abuses.js b/server/tests/utils/video-abuses.js index 596c824b3..c4dd87990 100644 --- a/server/tests/utils/video-abuses.js +++ b/server/tests/utils/video-abuses.js @@ -2,7 +2,7 @@ const request = require('supertest') -const videosUtils = { +const videosAbuseUtils = { getVideoAbusesList, getVideoAbusesListPagination, getVideoAbusesListSort, @@ -70,4 +70,4 @@ function getVideoAbusesListSort (url, token, sort, end) { // --------------------------------------------------------------------------- -module.exports = videosUtils +module.exports = videosAbuseUtils diff --git a/server/tests/utils/video-blacklists.js b/server/tests/utils/video-blacklists.js new file mode 100644 index 000000000..0a58dd631 --- /dev/null +++ b/server/tests/utils/video-blacklists.js @@ -0,0 +1,29 @@ +'use strict' + +const request = require('supertest') + +const videosBlacklistsUtils = { + addVideoToBlacklist +} + +// ---------------------- Export functions -------------------- + +function addVideoToBlacklist (url, token, videoId, specialStatus, end) { + if (!end) { + end = specialStatus + specialStatus = 204 + } + + const path = '/api/v1/videos/' + videoId + '/blacklist' + + request(url) + .post(path) + .set('Accept', 'application/json') + .set('Authorization', 'Bearer ' + token) + .expect(specialStatus) + .end(end) +} + +// --------------------------------------------------------------------------- + +module.exports = videosBlacklistsUtils -- cgit v1.2.3