From 91b6631984fa7097bd60aa013d1cf041d7b95f58 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 29 May 2019 15:09:38 +0200 Subject: Add pagination to account video channels endpoint --- shared/extra-utils/videos/video-channels.ts | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'shared/extra-utils') diff --git a/shared/extra-utils/videos/video-channels.ts b/shared/extra-utils/videos/video-channels.ts index 93a257bf9..b4755b486 100644 --- a/shared/extra-utils/videos/video-channels.ts +++ b/shared/extra-utils/videos/video-channels.ts @@ -1,6 +1,6 @@ import * as request from 'supertest' import { VideoChannelCreate, VideoChannelUpdate } from '../../models/videos' -import { updateAvatarRequest } from '../requests/requests' +import { makeGetRequest, updateAvatarRequest } from '../requests/requests' import { getMyUserInformation, ServerInfo } from '..' import { User } from '../..' @@ -19,14 +19,28 @@ function getVideoChannelsList (url: string, start: number, count: number, sort?: .expect('Content-Type', /json/) } -function getAccountVideoChannelsList (url: string, accountName: string, specialStatus = 200) { +function getAccountVideoChannelsList (parameters: { + url: string, + accountName: string, + start?: number, + count?: number, + sort?: string, + specialStatus?: number +}) { + const { url, accountName, start, count, sort = 'createdAt', specialStatus = 200 } = parameters + const path = '/api/v1/accounts/' + accountName + '/video-channels' - return request(url) - .get(path) - .set('Accept', 'application/json') - .expect(specialStatus) - .expect('Content-Type', /json/) + return makeGetRequest({ + url, + path, + query: { + start, + count, + sort + }, + statusCodeExpected: specialStatus + }) } function addVideoChannel ( -- cgit v1.2.3