From a54618880c394ad7571f3f3222dc96ec2dd10d9a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 9 Jul 2021 11:21:30 +0200 Subject: Introduce channels command --- server/tests/cli/peertube.ts | 5 ++--- server/tests/cli/update-host.ts | 10 ++++------ 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'server/tests/cli') diff --git a/server/tests/cli/peertube.ts b/server/tests/cli/peertube.ts index 64a93ebb5..ef7ab5bd5 100644 --- a/server/tests/cli/peertube.ts +++ b/server/tests/cli/peertube.ts @@ -4,7 +4,6 @@ import 'mocha' import { expect } from 'chai' import { Video, VideoDetails } from '../../../shared' import { - addVideoChannel, areHttpImportTestsDisabled, buildAbsoluteFixturePath, cleanupTests, @@ -44,8 +43,8 @@ describe('Test CLI wrapper', function () { userAccessToken = await userLogin(server, { username: 'user_1', password: 'super_password' }) { - const args = { name: 'user_channel', displayName: 'User channel', support: 'super support text' } - await addVideoChannel(server.url, userAccessToken, args) + const attributes = { name: 'user_channel', displayName: 'User channel', support: 'super support text' } + await server.channelsCommand.create({ token: userAccessToken, attributes }) } cliCommand = server.cliCommand diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts index f6131a99f..09a3dd1e7 100644 --- a/server/tests/cli/update-host.ts +++ b/server/tests/cli/update-host.ts @@ -2,13 +2,11 @@ import 'mocha' import { - addVideoChannel, addVideoCommentThread, cleanupTests, createUser, flushAndRunServer, getVideo, - getVideoChannelsList, getVideosList, killallServers, makeActivityPubGetRequest, @@ -53,7 +51,7 @@ describe('Test update host scripts', function () { displayName: 'second video channel', description: 'super video channel description' } - await addVideoChannel(server.url, server.accessToken, videoChannel) + await server.channelsCommand.create({ attributes: videoChannel }) // Create comments const text = 'my super first comment' @@ -91,10 +89,10 @@ describe('Test update host scripts', function () { }) it('Should have updated video channels url', async function () { - const res = await getVideoChannelsList(server.url, 0, 5, '-name') - expect(res.body.total).to.equal(3) + const { data, total } = await server.channelsCommand.list({ sort: '-name' }) + expect(total).to.equal(3) - for (const channel of res.body.data) { + for (const channel of data) { const { body } = await makeActivityPubGetRequest(server.url, '/video-channels/' + channel.name) expect(body.id).to.equal('http://localhost:9002/video-channels/' + channel.name) -- cgit v1.2.3