aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/video-blacklists.js
blob: 0a58dd631999274dcf0f4081946ef4c24c576bf9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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