aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/videos
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/utils/videos')
-rw-r--r--server/tests/utils/videos/video-channels.ts35
1 files changed, 24 insertions, 11 deletions
diff --git a/server/tests/utils/videos/video-channels.ts b/server/tests/utils/videos/video-channels.ts
index 2d095d8ab..cfc541431 100644
--- a/server/tests/utils/videos/video-channels.ts
+++ b/server/tests/utils/videos/video-channels.ts
@@ -7,7 +7,7 @@ type VideoChannelAttributes = {
7} 7}
8 8
9function getVideoChannelsList (url: string, start: number, count: number, sort?: string) { 9function getVideoChannelsList (url: string, start: number, count: number, sort?: string) {
10 const path = '/api/v1/videos/channels' 10 const path = '/api/v1/video-channels'
11 11
12 const req = request(url) 12 const req = request(url)
13 .get(path) 13 .get(path)
@@ -22,7 +22,7 @@ function getVideoChannelsList (url: string, start: number, count: number, sort?:
22} 22}
23 23
24function getAccountVideoChannelsList (url: string, accountId: number | string, specialStatus = 200) { 24function getAccountVideoChannelsList (url: string, accountId: number | string, specialStatus = 200) {
25 const path = '/api/v1/videos/accounts/' + accountId + '/channels' 25 const path = '/api/v1/accounts/' + accountId + '/video-channels'
26 26
27 return request(url) 27 return request(url)
28 .get(path) 28 .get(path)
@@ -31,8 +31,14 @@ function getAccountVideoChannelsList (url: string, accountId: number | string, s
31 .expect('Content-Type', /json/) 31 .expect('Content-Type', /json/)
32} 32}
33 33
34function addVideoChannel (url: string, token: string, videoChannelAttributesArg: VideoChannelAttributes, expectedStatus = 200) { 34function addVideoChannel (
35 const path = '/api/v1/videos/channels' 35 url: string,
36 token: string,
37 accountId: number,
38 videoChannelAttributesArg: VideoChannelAttributes,
39 expectedStatus = 200
40) {
41 const path = '/api/v1/accounts/' + accountId + '/video-channels/'
36 42
37 // Default attributes 43 // Default attributes
38 let attributes = { 44 let attributes = {
@@ -50,9 +56,16 @@ function addVideoChannel (url: string, token: string, videoChannelAttributesArg:
50 .expect(expectedStatus) 56 .expect(expectedStatus)
51} 57}
52 58
53function updateVideoChannel (url: string, token: string, channelId: number, attributes: VideoChannelAttributes, expectedStatus = 204) { 59function updateVideoChannel (
60 url: string,
61 token: string,
62 accountId: number,
63 channelId: number,
64 attributes: VideoChannelAttributes,
65 expectedStatus = 204
66) {
54 const body = {} 67 const body = {}
55 const path = '/api/v1/videos/channels/' + channelId 68 const path = '/api/v1/accounts/' + accountId + '/video-channels/' + channelId
56 69
57 if (attributes.name) body['name'] = attributes.name 70 if (attributes.name) body['name'] = attributes.name
58 if (attributes.description) body['description'] = attributes.description 71 if (attributes.description) body['description'] = attributes.description
@@ -66,18 +79,18 @@ function updateVideoChannel (url: string, token: string, channelId: number, attr
66 .expect(expectedStatus) 79 .expect(expectedStatus)
67} 80}
68 81
69function deleteVideoChannel (url: string, token: string, channelId: number, expectedStatus = 204) { 82function deleteVideoChannel (url: string, token: string, accountId: number, channelId: number, expectedStatus = 204) {
70 const path = '/api/v1/videos/channels/' 83 const path = '/api/v1/accounts/' + accountId + '/video-channels/' + channelId
71 84
72 return request(url) 85 return request(url)
73 .delete(path + channelId) 86 .delete(path)
74 .set('Accept', 'application/json') 87 .set('Accept', 'application/json')
75 .set('Authorization', 'Bearer ' + token) 88 .set('Authorization', 'Bearer ' + token)
76 .expect(expectedStatus) 89 .expect(expectedStatus)
77} 90}
78 91
79function getVideoChannel (url: string, channelId: number) { 92function getVideoChannel (url: string, accountId: number, channelId: number) {
80 const path = '/api/v1/videos/channels/' + channelId 93 const path = '/api/v1/accounts/' + accountId + '/video-channels/' + channelId
81 94
82 return request(url) 95 return request(url)
83 .get(path) 96 .get(path)