]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/utils/videos.ts
Fix activitypub check headers
[github/Chocobozzz/PeerTube.git] / server / tests / utils / videos.ts
index d4d5faf0a6e78388ee48dad1a8184adceb78c319..73a9f1a0abbc6024cecf2494d6cce3ab10eed1a2 100644 (file)
@@ -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
 }