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/api/check-params/video-channels.ts | |
parent | 57f879a540551c3b958b0991c8e1e3657a4481d8 (diff) | |
download | PeerTube-a54618880c394ad7571f3f3222dc96ec2dd10d9a.tar.gz PeerTube-a54618880c394ad7571f3f3222dc96ec2dd10d9a.tar.zst PeerTube-a54618880c394ad7571f3f3222dc96ec2dd10d9a.zip |
Introduce channels command
Diffstat (limited to 'server/tests/api/check-params/video-channels.ts')
-rw-r--r-- | server/tests/api/check-params/video-channels.ts | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts index 5c02afd31..d29346dc3 100644 --- a/server/tests/api/check-params/video-channels.ts +++ b/server/tests/api/check-params/video-channels.ts | |||
@@ -6,11 +6,10 @@ import { omit } from 'lodash' | |||
6 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | 6 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
7 | import { | 7 | import { |
8 | buildAbsoluteFixturePath, | 8 | buildAbsoluteFixturePath, |
9 | ChannelsCommand, | ||
9 | cleanupTests, | 10 | cleanupTests, |
10 | createUser, | 11 | createUser, |
11 | deleteVideoChannel, | ||
12 | flushAndRunServer, | 12 | flushAndRunServer, |
13 | getAccountVideoChannelsList, | ||
14 | immutableAssign, | 13 | immutableAssign, |
15 | makeGetRequest, | 14 | makeGetRequest, |
16 | makePostBodyRequest, | 15 | makePostBodyRequest, |
@@ -33,6 +32,7 @@ describe('Test video channels API validator', function () { | |||
33 | const videoChannelPath = '/api/v1/video-channels' | 32 | const videoChannelPath = '/api/v1/video-channels' |
34 | let server: ServerInfo | 33 | let server: ServerInfo |
35 | let accessTokenUser: string | 34 | let accessTokenUser: string |
35 | let command: ChannelsCommand | ||
36 | 36 | ||
37 | // --------------------------------------------------------------- | 37 | // --------------------------------------------------------------- |
38 | 38 | ||
@@ -52,6 +52,8 @@ describe('Test video channels API validator', function () { | |||
52 | await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) | 52 | await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) |
53 | accessTokenUser = await userLogin(server, user) | 53 | accessTokenUser = await userLogin(server, user) |
54 | } | 54 | } |
55 | |||
56 | command = server.channelsCommand | ||
55 | }) | 57 | }) |
56 | 58 | ||
57 | describe('When listing a video channels', function () { | 59 | describe('When listing a video channels', function () { |
@@ -84,7 +86,7 @@ describe('Test video channels API validator', function () { | |||
84 | }) | 86 | }) |
85 | 87 | ||
86 | it('Should fail with a unknown account', async function () { | 88 | it('Should fail with a unknown account', async function () { |
87 | await getAccountVideoChannelsList({ url: server.url, accountName: 'unknown', specialStatus: HttpStatusCode.NOT_FOUND_404 }) | 89 | await server.channelsCommand.listByAccount({ accountName: 'unknown', expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
88 | }) | 90 | }) |
89 | 91 | ||
90 | it('Should succeed with the correct parameters', async function () { | 92 | it('Should succeed with the correct parameters', async function () { |
@@ -327,23 +329,23 @@ describe('Test video channels API validator', function () { | |||
327 | 329 | ||
328 | describe('When deleting a video channel', function () { | 330 | describe('When deleting a video channel', function () { |
329 | it('Should fail with a non authenticated user', async function () { | 331 | it('Should fail with a non authenticated user', async function () { |
330 | await deleteVideoChannel(server.url, 'coucou', 'super_channel', HttpStatusCode.UNAUTHORIZED_401) | 332 | await command.delete({ token: 'coucou', channelName: 'super_channel', expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) |
331 | }) | 333 | }) |
332 | 334 | ||
333 | it('Should fail with another authenticated user', async function () { | 335 | it('Should fail with another authenticated user', async function () { |
334 | await deleteVideoChannel(server.url, accessTokenUser, 'super_channel', HttpStatusCode.FORBIDDEN_403) | 336 | await command.delete({ token: accessTokenUser, channelName: 'super_channel', expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
335 | }) | 337 | }) |
336 | 338 | ||
337 | it('Should fail with an unknown video channel id', async function () { | 339 | it('Should fail with an unknown video channel id', async function () { |
338 | await deleteVideoChannel(server.url, server.accessToken, 'super_channel2', HttpStatusCode.NOT_FOUND_404) | 340 | await command.delete({ channelName: 'super_channel2', expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
339 | }) | 341 | }) |
340 | 342 | ||
341 | it('Should succeed with the correct parameters', async function () { | 343 | it('Should succeed with the correct parameters', async function () { |
342 | await deleteVideoChannel(server.url, server.accessToken, 'super_channel') | 344 | await command.delete({ channelName: 'super_channel' }) |
343 | }) | 345 | }) |
344 | 346 | ||
345 | it('Should fail to delete the last user video channel', async function () { | 347 | it('Should fail to delete the last user video channel', async function () { |
346 | await deleteVideoChannel(server.url, server.accessToken, 'root_channel', HttpStatusCode.CONFLICT_409) | 348 | await command.delete({ channelName: 'root_channel', expectedStatus: HttpStatusCode.CONFLICT_409 }) |
347 | }) | 349 | }) |
348 | }) | 350 | }) |
349 | 351 | ||