From 48dce1c90dff4e90a4bcffefaecf157336cf904b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 24 Apr 2018 17:05:32 +0200 Subject: Update video channel routes --- server/tests/utils/videos/video-channels.ts | 35 ++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 11 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 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 = { } function getVideoChannelsList (url: string, start: number, count: number, sort?: string) { - const path = '/api/v1/videos/channels' + const path = '/api/v1/video-channels' const req = request(url) .get(path) @@ -22,7 +22,7 @@ function getVideoChannelsList (url: string, start: number, count: number, sort?: } function getAccountVideoChannelsList (url: string, accountId: number | string, specialStatus = 200) { - const path = '/api/v1/videos/accounts/' + accountId + '/channels' + const path = '/api/v1/accounts/' + accountId + '/video-channels' return request(url) .get(path) @@ -31,8 +31,14 @@ function getAccountVideoChannelsList (url: string, accountId: number | string, s .expect('Content-Type', /json/) } -function addVideoChannel (url: string, token: string, videoChannelAttributesArg: VideoChannelAttributes, expectedStatus = 200) { - const path = '/api/v1/videos/channels' +function addVideoChannel ( + url: string, + token: string, + accountId: number, + videoChannelAttributesArg: VideoChannelAttributes, + expectedStatus = 200 +) { + const path = '/api/v1/accounts/' + accountId + '/video-channels/' // Default attributes let attributes = { @@ -50,9 +56,16 @@ function addVideoChannel (url: string, token: string, videoChannelAttributesArg: .expect(expectedStatus) } -function updateVideoChannel (url: string, token: string, channelId: number, attributes: VideoChannelAttributes, expectedStatus = 204) { +function updateVideoChannel ( + url: string, + token: string, + accountId: number, + channelId: number, + attributes: VideoChannelAttributes, + expectedStatus = 204 +) { const body = {} - const path = '/api/v1/videos/channels/' + channelId + const path = '/api/v1/accounts/' + accountId + '/video-channels/' + channelId if (attributes.name) body['name'] = attributes.name if (attributes.description) body['description'] = attributes.description @@ -66,18 +79,18 @@ function updateVideoChannel (url: string, token: string, channelId: number, attr .expect(expectedStatus) } -function deleteVideoChannel (url: string, token: string, channelId: number, expectedStatus = 204) { - const path = '/api/v1/videos/channels/' +function deleteVideoChannel (url: string, token: string, accountId: number, channelId: number, expectedStatus = 204) { + const path = '/api/v1/accounts/' + accountId + '/video-channels/' + channelId return request(url) - .delete(path + channelId) + .delete(path) .set('Accept', 'application/json') .set('Authorization', 'Bearer ' + token) .expect(expectedStatus) } -function getVideoChannel (url: string, channelId: number) { - const path = '/api/v1/videos/channels/' + channelId +function getVideoChannel (url: string, accountId: number, channelId: number) { + const path = '/api/v1/accounts/' + accountId + '/video-channels/' + channelId return request(url) .get(path) -- cgit v1.2.3