aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/utils')
-rw-r--r--server/tests/utils/videos/video-channels.ts10
-rw-r--r--server/tests/utils/videos/videos.ts42
2 files changed, 47 insertions, 5 deletions
diff --git a/server/tests/utils/videos/video-channels.ts b/server/tests/utils/videos/video-channels.ts
index cfc541431..0b4fa89b7 100644
--- a/server/tests/utils/videos/video-channels.ts
+++ b/server/tests/utils/videos/video-channels.ts
@@ -34,7 +34,7 @@ function getAccountVideoChannelsList (url: string, accountId: number | string, s
34function addVideoChannel ( 34function addVideoChannel (
35 url: string, 35 url: string,
36 token: string, 36 token: string,
37 accountId: number, 37 accountId: number | string,
38 videoChannelAttributesArg: VideoChannelAttributes, 38 videoChannelAttributesArg: VideoChannelAttributes,
39 expectedStatus = 200 39 expectedStatus = 200
40) { 40) {
@@ -59,8 +59,8 @@ function addVideoChannel (
59function updateVideoChannel ( 59function updateVideoChannel (
60 url: string, 60 url: string,
61 token: string, 61 token: string,
62 accountId: number, 62 accountId: number | string,
63 channelId: number, 63 channelId: number | string,
64 attributes: VideoChannelAttributes, 64 attributes: VideoChannelAttributes,
65 expectedStatus = 204 65 expectedStatus = 204
66) { 66) {
@@ -79,7 +79,7 @@ function updateVideoChannel (
79 .expect(expectedStatus) 79 .expect(expectedStatus)
80} 80}
81 81
82function deleteVideoChannel (url: string, token: string, accountId: number, channelId: number, expectedStatus = 204) { 82function deleteVideoChannel (url: string, token: string, accountId: number | string, channelId: number | string, expectedStatus = 204) {
83 const path = '/api/v1/accounts/' + accountId + '/video-channels/' + channelId 83 const path = '/api/v1/accounts/' + accountId + '/video-channels/' + channelId
84 84
85 return request(url) 85 return request(url)
@@ -89,7 +89,7 @@ function deleteVideoChannel (url: string, token: string, accountId: number, chan
89 .expect(expectedStatus) 89 .expect(expectedStatus)
90} 90}
91 91
92function getVideoChannel (url: string, accountId: number, channelId: number) { 92function getVideoChannel (url: string, accountId: number | string, channelId: number | string) {
93 const path = '/api/v1/accounts/' + accountId + '/video-channels/' + channelId 93 const path = '/api/v1/accounts/' + accountId + '/video-channels/' + channelId
94 94
95 return request(url) 95 return request(url)
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts
index 943c85cc7..2ba3a860b 100644
--- a/server/tests/utils/videos/videos.ts
+++ b/server/tests/utils/videos/videos.ts
@@ -167,6 +167,46 @@ function getMyVideos (url: string, accessToken: string, start: number, count: nu
167 .expect('Content-Type', /json/) 167 .expect('Content-Type', /json/)
168} 168}
169 169
170function getAccountVideos (url: string, accessToken: string, accountId: number | string, start: number, count: number, sort?: string) {
171 const path = '/api/v1/accounts/' + accountId + '/videos'
172
173 return makeGetRequest({
174 url,
175 path,
176 query: {
177 start,
178 count,
179 sort
180 },
181 token: accessToken,
182 statusCodeExpected: 200
183 })
184}
185
186function getVideoChannelVideos (
187 url: string,
188 accessToken: string,
189 accountId: number | string,
190 videoChannelId: number | string,
191 start: number,
192 count: number,
193 sort?: string
194) {
195 const path = '/api/v1/accounts/' + accountId + '/video-channels/' + videoChannelId + '/videos'
196
197 return makeGetRequest({
198 url,
199 path,
200 query: {
201 start,
202 count,
203 sort
204 },
205 token: accessToken,
206 statusCodeExpected: 200
207 })
208}
209
170function getVideosListPagination (url: string, start: number, count: number, sort?: string) { 210function getVideosListPagination (url: string, start: number, count: number, sort?: string) {
171 const path = '/api/v1/videos' 211 const path = '/api/v1/videos'
172 212
@@ -514,6 +554,8 @@ export {
514 getVideoPrivacies, 554 getVideoPrivacies,
515 getVideoLanguages, 555 getVideoLanguages,
516 getMyVideos, 556 getMyVideos,
557 getAccountVideos,
558 getVideoChannelVideos,
517 searchVideoWithToken, 559 searchVideoWithToken,
518 getVideo, 560 getVideo,
519 getVideoWithToken, 561 getVideoWithToken,