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/plugins/video-constants.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/plugins/video-constants.ts')
-rw-r--r-- | server/tests/plugins/video-constants.ts | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/server/tests/plugins/video-constants.ts b/server/tests/plugins/video-constants.ts index fec9196e2..5ee41fee1 100644 --- a/server/tests/plugins/video-constants.ts +++ b/server/tests/plugins/video-constants.ts | |||
@@ -16,6 +16,7 @@ import { | |||
16 | uploadVideo | 16 | uploadVideo |
17 | } from '../../../shared/extra-utils' | 17 | } from '../../../shared/extra-utils' |
18 | import { VideoDetails, VideoPlaylistPrivacy } from '../../../shared/models/videos' | 18 | import { VideoDetails, VideoPlaylistPrivacy } from '../../../shared/models/videos' |
19 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
19 | 20 | ||
20 | const expect = chai.expect | 21 | const expect = chai.expect |
21 | 22 | ||
@@ -89,12 +90,17 @@ describe('Test plugin altering video constants', function () { | |||
89 | 90 | ||
90 | it('Should not be able to create a video with this privacy', async function () { | 91 | it('Should not be able to create a video with this privacy', async function () { |
91 | const attrs = { name: 'video', privacy: 2 } | 92 | const attrs = { name: 'video', privacy: 2 } |
92 | await uploadVideo(server.url, server.accessToken, attrs, 400) | 93 | await uploadVideo(server.url, server.accessToken, attrs, HttpStatusCode.BAD_REQUEST_400) |
93 | }) | 94 | }) |
94 | 95 | ||
95 | it('Should not be able to create a video with this privacy', async function () { | 96 | it('Should not be able to create a video with this privacy', async function () { |
96 | const attrs = { displayName: 'video playlist', privacy: VideoPlaylistPrivacy.PRIVATE } | 97 | const attrs = { displayName: 'video playlist', privacy: VideoPlaylistPrivacy.PRIVATE } |
97 | await createVideoPlaylist({ url: server.url, token: server.accessToken, playlistAttrs: attrs, expectedStatus: 400 }) | 98 | await createVideoPlaylist({ |
99 | url: server.url, | ||
100 | token: server.accessToken, | ||
101 | playlistAttrs: attrs, | ||
102 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | ||
103 | }) | ||
98 | }) | 104 | }) |
99 | 105 | ||
100 | it('Should be able to upload a video with these values', async function () { | 106 | it('Should be able to upload a video with these values', async function () { |