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/feeds | |
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/feeds')
-rw-r--r-- | server/tests/feeds/feeds.ts | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.ts index 92a468192..f1055ea44 100644 --- a/server/tests/feeds/feeds.ts +++ b/server/tests/feeds/feeds.ts | |||
@@ -31,6 +31,7 @@ import { | |||
31 | import { waitJobs } from '../../../shared/extra-utils/server/jobs' | 31 | import { waitJobs } from '../../../shared/extra-utils/server/jobs' |
32 | import { addVideoCommentThread } from '../../../shared/extra-utils/videos/video-comments' | 32 | import { addVideoCommentThread } from '../../../shared/extra-utils/videos/video-comments' |
33 | import { User } from '../../../shared/models/users' | 33 | import { User } from '../../../shared/models/users' |
34 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
34 | 35 | ||
35 | chai.use(require('chai-xml')) | 36 | chai.use(require('chai-xml')) |
36 | chai.use(require('chai-json-schema')) | 37 | chai.use(require('chai-json-schema')) |
@@ -330,11 +331,16 @@ describe('Test syndication feeds', () => { | |||
330 | }) | 331 | }) |
331 | 332 | ||
332 | it('Should fail with an invalid token', async function () { | 333 | it('Should fail with an invalid token', async function () { |
333 | await getJSONfeed(servers[0].url, 'subscriptions', { accountId: feeduserAccountId, token: 'toto' }, 403) | 334 | await getJSONfeed(servers[0].url, 'subscriptions', { accountId: feeduserAccountId, token: 'toto' }, HttpStatusCode.FORBIDDEN_403) |
334 | }) | 335 | }) |
335 | 336 | ||
336 | it('Should fail with a token of another user', async function () { | 337 | it('Should fail with a token of another user', async function () { |
337 | await getJSONfeed(servers[0].url, 'subscriptions', { accountId: feeduserAccountId, token: userFeedToken }, 403) | 338 | await getJSONfeed( |
339 | servers[0].url, | ||
340 | 'subscriptions', | ||
341 | { accountId: feeduserAccountId, token: userFeedToken }, | ||
342 | HttpStatusCode.FORBIDDEN_403 | ||
343 | ) | ||
338 | }) | 344 | }) |
339 | 345 | ||
340 | it('Should list no videos for a user with videos but no subscriptions', async function () { | 346 | it('Should list no videos for a user with videos but no subscriptions', async function () { |
@@ -382,7 +388,12 @@ describe('Test syndication feeds', () => { | |||
382 | it('Should renew the token, and so have an invalid old token', async function () { | 388 | it('Should renew the token, and so have an invalid old token', async function () { |
383 | await renewUserScopedTokens(servers[0].url, userAccessToken) | 389 | await renewUserScopedTokens(servers[0].url, userAccessToken) |
384 | 390 | ||
385 | await getJSONfeed(servers[0].url, 'subscriptions', { accountId: userAccountId, token: userFeedToken, version: 3 }, 403) | 391 | await getJSONfeed( |
392 | servers[0].url, | ||
393 | 'subscriptions', | ||
394 | { accountId: userAccountId, token: userFeedToken, version: 3 }, | ||
395 | HttpStatusCode.FORBIDDEN_403 | ||
396 | ) | ||
386 | }) | 397 | }) |
387 | 398 | ||
388 | it('Should succeed with the new token', async function () { | 399 | it('Should succeed with the new token', async function () { |