X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Futils%2Fvideos.ts;h=73a9f1a0abbc6024cecf2494d6cce3ab10eed1a2;hb=1b5b10d13152d704d2396a1e53d56aba1a8e7e03;hp=d4d5faf0a6e78388ee48dad1a8184adceb78c319;hpb=11474c3cd904fa0fc07fc0a3a9a35496da17f300;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/utils/videos.ts b/server/tests/utils/videos.ts index d4d5faf0a..73a9f1a0a 100644 --- a/server/tests/utils/videos.ts +++ b/server/tests/utils/videos.ts @@ -46,26 +46,22 @@ function getVideoPrivacies (url: string) { return makeGetRequest(url, path) } -function getAllVideosListBy (url: string) { - const path = '/api/v1/videos' +function getVideo (url: string, id: number | string, expectedStatus = 200) { + const path = '/api/v1/videos/' + id return request(url) .get(path) - .query({ sort: 'createdAt' }) - .query({ start: 0 }) - .query({ count: 10000 }) .set('Accept', 'application/json') - .expect(200) - .expect('Content-Type', /json/) + .expect(expectedStatus) } -function getVideo (url: string, id: number | string, expectedStatus = 200) { - const path = '/api/v1/videos/' + id +function viewVideo (url: string, id: number | string, expectedStatus = 204) { + const path = '/api/v1/videos/' + id + '/views' return request(url) - .get(path) - .set('Accept', 'application/json') - .expect(expectedStatus) + .post(path) + .set('Accept', 'application/json') + .expect(expectedStatus) } function getVideoWithToken (url: string, token: string, id: number | string, expectedStatus = 200) { @@ -312,7 +308,6 @@ export { getVideoLicences, getVideoPrivacies, getVideoLanguages, - getAllVideosListBy, getMyVideos, getVideo, getVideoWithToken, @@ -327,5 +322,6 @@ export { uploadVideo, updateVideo, rateVideo, + viewVideo, parseTorrentVideo }