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-change-ownership.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-change-ownership.ts')
-rw-r--r-- | server/tests/api/videos/video-change-ownership.ts | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.ts index dee6575b9..fad4c8b1f 100644 --- a/server/tests/api/videos/video-change-ownership.ts +++ b/server/tests/api/videos/video-change-ownership.ts | |||
@@ -23,6 +23,7 @@ import { | |||
23 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' | 23 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' |
24 | import { User } from '../../../../shared/models/users' | 24 | import { User } from '../../../../shared/models/users' |
25 | import { VideoDetails } from '../../../../shared/models/videos' | 25 | import { VideoDetails } from '../../../../shared/models/videos' |
26 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
26 | 27 | ||
27 | const expect = chai.expect | 28 | const expect = chai.expect |
28 | 29 | ||
@@ -140,7 +141,7 @@ describe('Test video change ownership - nominal', function () { | |||
140 | it('Should not be possible to refuse the change of ownership from first user', async function () { | 141 | it('Should not be possible to refuse the change of ownership from first user', async function () { |
141 | this.timeout(10000) | 142 | this.timeout(10000) |
142 | 143 | ||
143 | await refuseChangeOwnership(servers[0].url, firstUserAccessToken, lastRequestChangeOwnershipId, 403) | 144 | await refuseChangeOwnership(servers[0].url, firstUserAccessToken, lastRequestChangeOwnershipId, HttpStatusCode.FORBIDDEN_403) |
144 | }) | 145 | }) |
145 | 146 | ||
146 | it('Should be possible to refuse the change of ownership from second user', async function () { | 147 | it('Should be possible to refuse the change of ownership from second user', async function () { |
@@ -177,7 +178,7 @@ describe('Test video change ownership - nominal', function () { | |||
177 | const secondUserInformationResponse = await getMyUserInformation(servers[0].url, secondUserAccessToken) | 178 | const secondUserInformationResponse = await getMyUserInformation(servers[0].url, secondUserAccessToken) |
178 | const secondUserInformation: User = secondUserInformationResponse.body | 179 | const secondUserInformation: User = secondUserInformationResponse.body |
179 | const channelId = secondUserInformation.videoChannels[0].id | 180 | const channelId = secondUserInformation.videoChannels[0].id |
180 | await acceptChangeOwnership(servers[0].url, firstUserAccessToken, lastRequestChangeOwnershipId, channelId, 403) | 181 | await acceptChangeOwnership(servers[0].url, firstUserAccessToken, lastRequestChangeOwnershipId, channelId, HttpStatusCode.FORBIDDEN_403) |
181 | }) | 182 | }) |
182 | 183 | ||
183 | it('Should be possible to accept the change of ownership from second user', async function () { | 184 | it('Should be possible to accept the change of ownership from second user', async function () { |
@@ -294,7 +295,14 @@ describe('Test video change ownership - quota too small', function () { | |||
294 | const secondUserInformationResponse = await getMyUserInformation(server.url, secondUserAccessToken) | 295 | const secondUserInformationResponse = await getMyUserInformation(server.url, secondUserAccessToken) |
295 | const secondUserInformation: User = secondUserInformationResponse.body | 296 | const secondUserInformation: User = secondUserInformationResponse.body |
296 | const channelId = secondUserInformation.videoChannels[0].id | 297 | const channelId = secondUserInformation.videoChannels[0].id |
297 | await acceptChangeOwnership(server.url, secondUserAccessToken, lastRequestChangeOwnershipId, channelId, 403) | 298 | |
299 | await acceptChangeOwnership( | ||
300 | server.url, | ||
301 | secondUserAccessToken, | ||
302 | lastRequestChangeOwnershipId, | ||
303 | channelId, | ||
304 | HttpStatusCode.PAYLOAD_TOO_LARGE_413 | ||
305 | ) | ||
298 | }) | 306 | }) |
299 | 307 | ||
300 | after(async function () { | 308 | after(async function () { |