From 6b738c7a31591a83fdcd9c78b6b1f98e543c378b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 25 Apr 2018 10:21:38 +0200 Subject: Video channel API routes refractor --- server/tests/utils/videos/video-channels.ts | 10 +++---- server/tests/utils/videos/videos.ts | 42 +++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 5 deletions(-) (limited to 'server/tests/utils') 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 function addVideoChannel ( url: string, token: string, - accountId: number, + accountId: number | string, videoChannelAttributesArg: VideoChannelAttributes, expectedStatus = 200 ) { @@ -59,8 +59,8 @@ function addVideoChannel ( function updateVideoChannel ( url: string, token: string, - accountId: number, - channelId: number, + accountId: number | string, + channelId: number | string, attributes: VideoChannelAttributes, expectedStatus = 204 ) { @@ -79,7 +79,7 @@ function updateVideoChannel ( .expect(expectedStatus) } -function deleteVideoChannel (url: string, token: string, accountId: number, channelId: number, expectedStatus = 204) { +function deleteVideoChannel (url: string, token: string, accountId: number | string, channelId: number | string, expectedStatus = 204) { const path = '/api/v1/accounts/' + accountId + '/video-channels/' + channelId return request(url) @@ -89,7 +89,7 @@ function deleteVideoChannel (url: string, token: string, accountId: number, chan .expect(expectedStatus) } -function getVideoChannel (url: string, accountId: number, channelId: number) { +function getVideoChannel (url: string, accountId: number | string, channelId: number | string) { const path = '/api/v1/accounts/' + accountId + '/video-channels/' + channelId 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 .expect('Content-Type', /json/) } +function getAccountVideos (url: string, accessToken: string, accountId: number | string, start: number, count: number, sort?: string) { + const path = '/api/v1/accounts/' + accountId + '/videos' + + return makeGetRequest({ + url, + path, + query: { + start, + count, + sort + }, + token: accessToken, + statusCodeExpected: 200 + }) +} + +function getVideoChannelVideos ( + url: string, + accessToken: string, + accountId: number | string, + videoChannelId: number | string, + start: number, + count: number, + sort?: string +) { + const path = '/api/v1/accounts/' + accountId + '/video-channels/' + videoChannelId + '/videos' + + return makeGetRequest({ + url, + path, + query: { + start, + count, + sort + }, + token: accessToken, + statusCodeExpected: 200 + }) +} + function getVideosListPagination (url: string, start: number, count: number, sort?: string) { const path = '/api/v1/videos' @@ -514,6 +554,8 @@ export { getVideoPrivacies, getVideoLanguages, getMyVideos, + getAccountVideos, + getVideoChannelVideos, searchVideoWithToken, getVideo, getVideoWithToken, -- cgit v1.2.3