function getVideoCategories (url: string) {
const path = '/api/v1/videos/categories'
- return makeGetRequest(url, path)
+ return makeGetRequest({
+ url,
+ path,
+ statusCodeExpected: 200
+ })
}
function getVideoLicences (url: string) {
const path = '/api/v1/videos/licences'
- return makeGetRequest(url, path)
+ return makeGetRequest({
+ url,
+ path,
+ statusCodeExpected: 200
+ })
}
function getVideoLanguages (url: string) {
const path = '/api/v1/videos/languages'
- return makeGetRequest(url, path)
+ return makeGetRequest({
+ url,
+ path,
+ statusCodeExpected: 200
+ })
}
function getVideoPrivacies (url: string) {
const path = '/api/v1/videos/privacies'
- return makeGetRequest(url, path)
+ return makeGetRequest({
+ url,
+ path,
+ statusCodeExpected: 200
+ })
}
function getVideo (url: string, id: number | string, expectedStatus = 200) {
.expect('Content-Type', /json/)
}
-function removeVideo (url: string, token: string, id: number, expectedStatus = 204) {
+function removeVideo (url: string, token: string, id: number | string, expectedStatus = 204) {
const path = '/api/v1/videos'
return request(url)
.get(imagePath)
.expect(200)
- const data = await readFilePromise(join(__dirname, '..', 'api', 'fixtures', imageName + '.jpg'))
+ const data = await readFilePromise(join(__dirname, '..', '..', 'api', 'fixtures', imageName + '.jpg'))
return data.equals(res.body)
} else {
if (isAbsolute(attributes.fixture)) {
filePath = attributes.fixture
} else {
- filePath = join(__dirname, '..', 'api', 'fixtures', attributes.fixture)
+ filePath = join(__dirname, '..', '..', 'api', 'fixtures', attributes.fixture)
}
return req.attach('videofile', filePath)
function parseTorrentVideo (server: ServerInfo, videoUUID: string, resolution: number) {
return new Promise<any>((res, rej) => {
const torrentName = videoUUID + '-' + resolution + '.torrent'
- const torrentPath = join(__dirname, '..', '..', '..', 'test' + server.serverNumber, 'torrents', torrentName)
+ const torrentPath = join(__dirname, '..', '..', '..', '..', 'test' + server.serverNumber, 'torrents', torrentName)
readFile(torrentPath, (err, data) => {
if (err) return rej(err)