diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-12-08 21:16:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-08 21:16:10 +0100 |
commit | f2eb23cd87cf32b8fe545178143b5f49e06a58da (patch) | |
tree | af7d59945af70e28fd85047e2c688c59a908f548 /server/tests/api/videos/video-privacy.ts | |
parent | c977fd3ec931c059111ddb2b8d6ddbb20b6b99a1 (diff) | |
download | PeerTube-f2eb23cd87cf32b8fe545178143b5f49e06a58da.tar.gz PeerTube-f2eb23cd87cf32b8fe545178143b5f49e06a58da.tar.zst PeerTube-f2eb23cd87cf32b8fe545178143b5f49e06a58da.zip |
emit more specific status codes on video upload (#3423)
- reduce http status codes list to potentially useful codes
- convert more codes to typed ones
- factorize html generator for error responses
Diffstat (limited to 'server/tests/api/videos/video-privacy.ts')
-rw-r--r-- | server/tests/api/videos/video-privacy.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts index 38e93bbe6..f25d75af4 100644 --- a/server/tests/api/videos/video-privacy.ts +++ b/server/tests/api/videos/video-privacy.ts | |||
@@ -18,6 +18,7 @@ import { createUser } from '../../../../shared/extra-utils/users/users' | |||
18 | import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../../../../shared/extra-utils/videos/videos' | 18 | import { getMyVideos, getVideo, getVideoWithToken, updateVideo } from '../../../../shared/extra-utils/videos/videos' |
19 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' | 19 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' |
20 | import { Video } from '@shared/models' | 20 | import { Video } from '@shared/models' |
21 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' | ||
21 | 22 | ||
22 | const expect = chai.expect | 23 | const expect = chai.expect |
23 | 24 | ||
@@ -110,8 +111,8 @@ describe('Test video privacy', function () { | |||
110 | }) | 111 | }) |
111 | 112 | ||
112 | it('Should not be able to watch the private/internal video with non authenticated user', async function () { | 113 | it('Should not be able to watch the private/internal video with non authenticated user', async function () { |
113 | await getVideo(servers[0].url, privateVideoUUID, 401) | 114 | await getVideo(servers[0].url, privateVideoUUID, HttpStatusCode.UNAUTHORIZED_401) |
114 | await getVideo(servers[0].url, internalVideoUUID, 401) | 115 | await getVideo(servers[0].url, internalVideoUUID, HttpStatusCode.UNAUTHORIZED_401) |
115 | }) | 116 | }) |
116 | 117 | ||
117 | it('Should not be able to watch the private video with another user', async function () { | 118 | it('Should not be able to watch the private video with another user', async function () { |
@@ -124,15 +125,15 @@ describe('Test video privacy', function () { | |||
124 | await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password }) | 125 | await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password }) |
125 | 126 | ||
126 | anotherUserToken = await userLogin(servers[0], user) | 127 | anotherUserToken = await userLogin(servers[0], user) |
127 | await getVideoWithToken(servers[0].url, anotherUserToken, privateVideoUUID, 403) | 128 | await getVideoWithToken(servers[0].url, anotherUserToken, privateVideoUUID, HttpStatusCode.FORBIDDEN_403) |
128 | }) | 129 | }) |
129 | 130 | ||
130 | it('Should be able to watch the internal video with another user', async function () { | 131 | it('Should be able to watch the internal video with another user', async function () { |
131 | await getVideoWithToken(servers[0].url, anotherUserToken, internalVideoUUID, 200) | 132 | await getVideoWithToken(servers[0].url, anotherUserToken, internalVideoUUID, HttpStatusCode.OK_200) |
132 | }) | 133 | }) |
133 | 134 | ||
134 | it('Should be able to watch the private video with the correct user', async function () { | 135 | it('Should be able to watch the private video with the correct user', async function () { |
135 | await getVideoWithToken(servers[0].url, servers[0].accessToken, privateVideoUUID, 200) | 136 | await getVideoWithToken(servers[0].url, servers[0].accessToken, privateVideoUUID, HttpStatusCode.OK_200) |
136 | }) | 137 | }) |
137 | 138 | ||
138 | it('Should upload an unlisted video on server 2', async function () { | 139 | it('Should upload an unlisted video on server 2', async function () { |
@@ -202,7 +203,7 @@ describe('Test video privacy', function () { | |||
202 | }) | 203 | }) |
203 | 204 | ||
204 | it('Should not be able to get non-federated unlisted video from federated server', async function () { | 205 | it('Should not be able to get non-federated unlisted video from federated server', async function () { |
205 | await getVideo(servers[1].url, nonFederatedUnlistedVideoUUID, 404) | 206 | await getVideo(servers[1].url, nonFederatedUnlistedVideoUUID, HttpStatusCode.NOT_FOUND_404) |
206 | }) | 207 | }) |
207 | 208 | ||
208 | it('Should update the private and internal videos to public on server 1', async function () { | 209 | it('Should update the private and internal videos to public on server 1', async function () { |