X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Futils%2Fvideos%2Fvideos.ts;h=7393942534b831be1da5fa0b5a5edb050ef2eedf;hb=59651eee5600839cdc62911a211d61457d8456b7;hp=6de1b8c92c9d1d00b59a1333f7a02837c5f475aa;hpb=c5d31dba56d669c0df0209761c43c5a6ac7cec4a;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index 6de1b8c92..739394253 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts @@ -21,25 +21,41 @@ type VideoAttributes = { 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) { @@ -131,7 +147,7 @@ function getVideosListSort (url: string, sort: string) { .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) @@ -188,7 +204,7 @@ async function testVideoImage (url: string, imageName: string, imagePath: string .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 { @@ -245,7 +261,7 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg 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) @@ -287,7 +303,7 @@ function rateVideo (url: string, accessToken: string, id: number, rating: string function parseTorrentVideo (server: ServerInfo, videoUUID: string, resolution: number) { return new Promise((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)