]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/videos/video-privacy.ts
Dissociate video file names and video uuid
[github/Chocobozzz/PeerTube.git] / server / tests / api / videos / video-privacy.ts
index 38e93bbe631361d23c9a05f55e6e7636feee6672..fed6ca0e0ac9e1b848a401ed63cfd19419592135 100644 (file)
@@ -18,6 +18,7 @@ import { createUser } from '../../../../shared/extra-utils/users/users'
 import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../../../../shared/extra-utils/videos/videos'
 import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
 import { Video } from '@shared/models'
+import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
 
 const expect = chai.expect
 
@@ -110,8 +111,8 @@ describe('Test video privacy', function () {
   })
 
   it('Should not be able to watch the private/internal video with non authenticated user', async function () {
-    await getVideo(servers[0].url, privateVideoUUID, 401)
-    await getVideo(servers[0].url, internalVideoUUID, 401)
+    await getVideo(servers[0].url, privateVideoUUID, HttpStatusCode.UNAUTHORIZED_401)
+    await getVideo(servers[0].url, internalVideoUUID, HttpStatusCode.UNAUTHORIZED_401)
   })
 
   it('Should not be able to watch the private video with another user', async function () {
@@ -124,19 +125,19 @@ describe('Test video privacy', function () {
     await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password })
 
     anotherUserToken = await userLogin(servers[0], user)
-    await getVideoWithToken(servers[0].url, anotherUserToken, privateVideoUUID, 403)
+    await getVideoWithToken(servers[0].url, anotherUserToken, privateVideoUUID, HttpStatusCode.FORBIDDEN_403)
   })
 
   it('Should be able to watch the internal video with another user', async function () {
-    await getVideoWithToken(servers[0].url, anotherUserToken, internalVideoUUID, 200)
+    await getVideoWithToken(servers[0].url, anotherUserToken, internalVideoUUID, HttpStatusCode.OK_200)
   })
 
   it('Should be able to watch the private video with the correct user', async function () {
-    await getVideoWithToken(servers[0].url, servers[0].accessToken, privateVideoUUID, 200)
+    await getVideoWithToken(servers[0].url, servers[0].accessToken, privateVideoUUID, HttpStatusCode.OK_200)
   })
 
   it('Should upload an unlisted video on server 2', async function () {
-    this.timeout(30000)
+    this.timeout(60000)
 
     const attributes = {
       name: 'unlisted video',
@@ -202,7 +203,7 @@ describe('Test video privacy', function () {
   })
 
   it('Should not be able to get non-federated unlisted video from federated server', async function () {
-    await getVideo(servers[1].url, nonFederatedUnlistedVideoUUID, 404)
+    await getVideo(servers[1].url, nonFederatedUnlistedVideoUUID, HttpStatusCode.NOT_FOUND_404)
   })
 
   it('Should update the private and internal videos to public on server 1', async function () {