From f5b0af50c85e2f8b6b2b054ac1f47123cacbe08d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 24 Aug 2018 11:04:02 +0200 Subject: Search video channel handle/uri --- server/tests/utils/search/video-channels.ts | 22 ++++++++++++++++++++++ server/tests/utils/videos/video-channels.ts | 12 ++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 server/tests/utils/search/video-channels.ts (limited to 'server/tests/utils') diff --git a/server/tests/utils/search/video-channels.ts b/server/tests/utils/search/video-channels.ts new file mode 100644 index 000000000..0532134ae --- /dev/null +++ b/server/tests/utils/search/video-channels.ts @@ -0,0 +1,22 @@ +import { makeGetRequest } from '../requests/requests' + +function searchVideoChannel (url: string, search: string, token?: string, statusCodeExpected = 200) { + const path = '/api/v1/search/video-channels' + + return makeGetRequest({ + url, + path, + query: { + sort: '-createdAt', + search + }, + token, + statusCodeExpected + }) +} + +// --------------------------------------------------------------------------- + +export { + searchVideoChannel +} diff --git a/server/tests/utils/videos/video-channels.ts b/server/tests/utils/videos/video-channels.ts index 1eea22b31..092985777 100644 --- a/server/tests/utils/videos/video-channels.ts +++ b/server/tests/utils/videos/video-channels.ts @@ -54,12 +54,12 @@ function addVideoChannel ( function updateVideoChannel ( url: string, token: string, - channelId: number | string, + channelName: string, attributes: VideoChannelUpdate, expectedStatus = 204 ) { const body = {} - const path = '/api/v1/video-channels/' + channelId + const path = '/api/v1/video-channels/' + channelName if (attributes.displayName) body['displayName'] = attributes.displayName if (attributes.description) body['description'] = attributes.description @@ -73,8 +73,8 @@ function updateVideoChannel ( .expect(expectedStatus) } -function deleteVideoChannel (url: string, token: string, channelId: number | string, expectedStatus = 204) { - const path = '/api/v1/video-channels/' + channelId +function deleteVideoChannel (url: string, token: string, channelName: string, expectedStatus = 204) { + const path = '/api/v1/video-channels/' + channelName return request(url) .delete(path) @@ -83,8 +83,8 @@ function deleteVideoChannel (url: string, token: string, channelId: number | str .expect(expectedStatus) } -function getVideoChannel (url: string, channelId: number | string) { - const path = '/api/v1/video-channels/' + channelId +function getVideoChannel (url: string, channelName: string) { + const path = '/api/v1/video-channels/' + channelName return request(url) .get(path) -- cgit v1.2.3