diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-09 11:21:30 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | a54618880c394ad7571f3f3222dc96ec2dd10d9a (patch) | |
tree | c9f7b05e578abc2383bccd707c11438c61857c72 /server/tests/cli | |
parent | 57f879a540551c3b958b0991c8e1e3657a4481d8 (diff) | |
download | PeerTube-a54618880c394ad7571f3f3222dc96ec2dd10d9a.tar.gz PeerTube-a54618880c394ad7571f3f3222dc96ec2dd10d9a.tar.zst PeerTube-a54618880c394ad7571f3f3222dc96ec2dd10d9a.zip |
Introduce channels command
Diffstat (limited to 'server/tests/cli')
-rw-r--r-- | server/tests/cli/peertube.ts | 5 | ||||
-rw-r--r-- | server/tests/cli/update-host.ts | 10 |
2 files changed, 6 insertions, 9 deletions
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' | |||
4 | import { expect } from 'chai' | 4 | import { expect } from 'chai' |
5 | import { Video, VideoDetails } from '../../../shared' | 5 | import { Video, VideoDetails } from '../../../shared' |
6 | import { | 6 | import { |
7 | addVideoChannel, | ||
8 | areHttpImportTestsDisabled, | 7 | areHttpImportTestsDisabled, |
9 | buildAbsoluteFixturePath, | 8 | buildAbsoluteFixturePath, |
10 | cleanupTests, | 9 | cleanupTests, |
@@ -44,8 +43,8 @@ describe('Test CLI wrapper', function () { | |||
44 | userAccessToken = await userLogin(server, { username: 'user_1', password: 'super_password' }) | 43 | userAccessToken = await userLogin(server, { username: 'user_1', password: 'super_password' }) |
45 | 44 | ||
46 | { | 45 | { |
47 | const args = { name: 'user_channel', displayName: 'User channel', support: 'super support text' } | 46 | const attributes = { name: 'user_channel', displayName: 'User channel', support: 'super support text' } |
48 | await addVideoChannel(server.url, userAccessToken, args) | 47 | await server.channelsCommand.create({ token: userAccessToken, attributes }) |
49 | } | 48 | } |
50 | 49 | ||
51 | cliCommand = server.cliCommand | 50 | 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 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { | 4 | import { |
5 | addVideoChannel, | ||
6 | addVideoCommentThread, | 5 | addVideoCommentThread, |
7 | cleanupTests, | 6 | cleanupTests, |
8 | createUser, | 7 | createUser, |
9 | flushAndRunServer, | 8 | flushAndRunServer, |
10 | getVideo, | 9 | getVideo, |
11 | getVideoChannelsList, | ||
12 | getVideosList, | 10 | getVideosList, |
13 | killallServers, | 11 | killallServers, |
14 | makeActivityPubGetRequest, | 12 | makeActivityPubGetRequest, |
@@ -53,7 +51,7 @@ describe('Test update host scripts', function () { | |||
53 | displayName: 'second video channel', | 51 | displayName: 'second video channel', |
54 | description: 'super video channel description' | 52 | description: 'super video channel description' |
55 | } | 53 | } |
56 | await addVideoChannel(server.url, server.accessToken, videoChannel) | 54 | await server.channelsCommand.create({ attributes: videoChannel }) |
57 | 55 | ||
58 | // Create comments | 56 | // Create comments |
59 | const text = 'my super first comment' | 57 | const text = 'my super first comment' |
@@ -91,10 +89,10 @@ describe('Test update host scripts', function () { | |||
91 | }) | 89 | }) |
92 | 90 | ||
93 | it('Should have updated video channels url', async function () { | 91 | it('Should have updated video channels url', async function () { |
94 | const res = await getVideoChannelsList(server.url, 0, 5, '-name') | 92 | const { data, total } = await server.channelsCommand.list({ sort: '-name' }) |
95 | expect(res.body.total).to.equal(3) | 93 | expect(total).to.equal(3) |
96 | 94 | ||
97 | for (const channel of res.body.data) { | 95 | for (const channel of data) { |
98 | const { body } = await makeActivityPubGetRequest(server.url, '/video-channels/' + channel.name) | 96 | const { body } = await makeActivityPubGetRequest(server.url, '/video-channels/' + channel.name) |
99 | 97 | ||
100 | expect(body.id).to.equal('http://localhost:9002/video-channels/' + channel.name) | 98 | expect(body.id).to.equal('http://localhost:9002/video-channels/' + channel.name) |