diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2020-12-07 14:32:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 14:32:36 +0100 |
commit | 2d53be0267acc49cda46707b885096193a1f4e9c (patch) | |
tree | 887061a34bc67f40acbb96a6278f9544bf83caeb /server/tests/api/videos | |
parent | adc1f09c0dbd997f34028c1c82d1c118dc8ead80 (diff) | |
download | PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.gz PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.zst PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.zip |
replace numbers with typed http status codes (#3409)
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r-- | server/tests/api/videos/video-transcoder.ts | 11 | ||||
-rw-r--r-- | server/tests/api/videos/videos-filter.ts | 3 |
2 files changed, 8 insertions, 6 deletions
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts index f9500d617..f88c59f0d 100644 --- a/server/tests/api/videos/video-transcoder.ts +++ b/server/tests/api/videos/video-transcoder.ts | |||
@@ -37,6 +37,7 @@ import { | |||
37 | getVideoFileFPS, | 37 | getVideoFileFPS, |
38 | getVideoFileResolution | 38 | getVideoFileResolution |
39 | } from '../../../helpers/ffprobe-utils' | 39 | } from '../../../helpers/ffprobe-utils' |
40 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
40 | 41 | ||
41 | const expect = chai.expect | 42 | const expect = chai.expect |
42 | 43 | ||
@@ -280,7 +281,7 @@ describe('Test video transcoding', function () { | |||
280 | expect(videoToFindInList).to.be.undefined | 281 | expect(videoToFindInList).to.be.undefined |
281 | 282 | ||
282 | // Server 1 should not have the video yet | 283 | // Server 1 should not have the video yet |
283 | await getVideo(servers[0].url, videoId, 404) | 284 | await getVideo(servers[0].url, videoId, HttpStatusCode.NOT_FOUND_404) |
284 | } | 285 | } |
285 | 286 | ||
286 | await waitJobs(servers) | 287 | await waitJobs(servers) |
@@ -400,8 +401,8 @@ describe('Test video transcoding', function () { | |||
400 | 401 | ||
401 | expect(videoDetails.files).to.have.lengthOf(1) | 402 | expect(videoDetails.files).to.have.lengthOf(1) |
402 | 403 | ||
403 | await makeGetRequest({ url: server.url, path: videoDetails.thumbnailPath, statusCodeExpected: 200 }) | 404 | await makeGetRequest({ url: server.url, path: videoDetails.thumbnailPath, statusCodeExpected: HttpStatusCode.OK_200 }) |
404 | await makeGetRequest({ url: server.url, path: videoDetails.previewPath, statusCodeExpected: 200 }) | 405 | await makeGetRequest({ url: server.url, path: videoDetails.previewPath, statusCodeExpected: HttpStatusCode.OK_200 }) |
405 | 406 | ||
406 | const magnetUri = videoDetails.files[0].magnetUri | 407 | const magnetUri = videoDetails.files[0].magnetUri |
407 | expect(magnetUri).to.contain('.mp4') | 408 | expect(magnetUri).to.contain('.mp4') |
@@ -425,8 +426,8 @@ describe('Test video transcoding', function () { | |||
425 | 426 | ||
426 | expect(videoDetails.files).to.have.lengthOf(1) | 427 | expect(videoDetails.files).to.have.lengthOf(1) |
427 | 428 | ||
428 | await makeGetRequest({ url: server.url, path: videoDetails.thumbnailPath, statusCodeExpected: 200 }) | 429 | await makeGetRequest({ url: server.url, path: videoDetails.thumbnailPath, statusCodeExpected: HttpStatusCode.OK_200 }) |
429 | await makeGetRequest({ url: server.url, path: videoDetails.previewPath, statusCodeExpected: 200 }) | 430 | await makeGetRequest({ url: server.url, path: videoDetails.previewPath, statusCodeExpected: HttpStatusCode.OK_200 }) |
430 | 431 | ||
431 | const magnetUri = videoDetails.files[0].magnetUri | 432 | const magnetUri = videoDetails.files[0].magnetUri |
432 | expect(magnetUri).to.contain('.mp4') | 433 | expect(magnetUri).to.contain('.mp4') |
diff --git a/server/tests/api/videos/videos-filter.ts b/server/tests/api/videos/videos-filter.ts index 6b9a4b6d4..2961c8e78 100644 --- a/server/tests/api/videos/videos-filter.ts +++ b/server/tests/api/videos/videos-filter.ts | |||
@@ -15,10 +15,11 @@ import { | |||
15 | } from '../../../../shared/extra-utils' | 15 | } from '../../../../shared/extra-utils' |
16 | import { Video, VideoPrivacy } from '../../../../shared/models/videos' | 16 | import { Video, VideoPrivacy } from '../../../../shared/models/videos' |
17 | import { UserRole } from '../../../../shared/models/users' | 17 | import { UserRole } from '../../../../shared/models/users' |
18 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
18 | 19 | ||
19 | const expect = chai.expect | 20 | const expect = chai.expect |
20 | 21 | ||
21 | async function getVideosNames (server: ServerInfo, token: string, filter: string, statusCodeExpected = 200) { | 22 | async function getVideosNames (server: ServerInfo, token: string, filter: string, statusCodeExpected = HttpStatusCode.OK_200) { |
22 | const paths = [ | 23 | const paths = [ |
23 | '/api/v1/video-channels/root_channel/videos', | 24 | '/api/v1/video-channels/root_channel/videos', |
24 | '/api/v1/accounts/root/videos', | 25 | '/api/v1/accounts/root/videos', |