aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos/video-change-ownership.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-12-07 14:32:36 +0100
committerGitHub <noreply@github.com>2020-12-07 14:32:36 +0100
commit2d53be0267acc49cda46707b885096193a1f4e9c (patch)
tree887061a34bc67f40acbb96a6278f9544bf83caeb /shared/extra-utils/videos/video-change-ownership.ts
parentadc1f09c0dbd997f34028c1c82d1c118dc8ead80 (diff)
downloadPeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.gz
PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.tar.zst
PeerTube-2d53be0267acc49cda46707b885096193a1f4e9c.zip
replace numbers with typed http status codes (#3409)
Diffstat (limited to 'shared/extra-utils/videos/video-change-ownership.ts')
-rw-r--r--shared/extra-utils/videos/video-change-ownership.ts26
1 files changed, 22 insertions, 4 deletions
diff --git a/shared/extra-utils/videos/video-change-ownership.ts b/shared/extra-utils/videos/video-change-ownership.ts
index 371d02000..ef82a7636 100644
--- a/shared/extra-utils/videos/video-change-ownership.ts
+++ b/shared/extra-utils/videos/video-change-ownership.ts
@@ -1,6 +1,13 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
2 3
3function changeVideoOwnership (url: string, token: string, videoId: number | string, username, expectedStatus = 204) { 4function changeVideoOwnership (
5 url: string,
6 token: string,
7 videoId: number | string,
8 username,
9 expectedStatus = HttpStatusCode.NO_CONTENT_204
10) {
4 const path = '/api/v1/videos/' + videoId + '/give-ownership' 11 const path = '/api/v1/videos/' + videoId + '/give-ownership'
5 12
6 return request(url) 13 return request(url)
@@ -19,11 +26,17 @@ function getVideoChangeOwnershipList (url: string, token: string) {
19 .query({ sort: '-createdAt' }) 26 .query({ sort: '-createdAt' })
20 .set('Accept', 'application/json') 27 .set('Accept', 'application/json')
21 .set('Authorization', 'Bearer ' + token) 28 .set('Authorization', 'Bearer ' + token)
22 .expect(200) 29 .expect(HttpStatusCode.OK_200)
23 .expect('Content-Type', /json/) 30 .expect('Content-Type', /json/)
24} 31}
25 32
26function acceptChangeOwnership (url: string, token: string, ownershipId: string, channelId: number, expectedStatus = 204) { 33function acceptChangeOwnership (
34 url: string,
35 token: string,
36 ownershipId: string,
37 channelId: number,
38 expectedStatus = HttpStatusCode.NO_CONTENT_204
39) {
27 const path = '/api/v1/videos/ownership/' + ownershipId + '/accept' 40 const path = '/api/v1/videos/ownership/' + ownershipId + '/accept'
28 41
29 return request(url) 42 return request(url)
@@ -34,7 +47,12 @@ function acceptChangeOwnership (url: string, token: string, ownershipId: string,
34 .expect(expectedStatus) 47 .expect(expectedStatus)
35} 48}
36 49
37function refuseChangeOwnership (url: string, token: string, ownershipId: string, expectedStatus = 204) { 50function refuseChangeOwnership (
51 url: string,
52 token: string,
53 ownershipId: string,
54 expectedStatus = HttpStatusCode.NO_CONTENT_204
55) {
38 const path = '/api/v1/videos/ownership/' + ownershipId + '/refuse' 56 const path = '/api/v1/videos/ownership/' + ownershipId + '/refuse'
39 57
40 return request(url) 58 return request(url)