diff options
Diffstat (limited to 'server/tests/api/check-params/video-channels.ts')
-rw-r--r-- | server/tests/api/check-params/video-channels.ts | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts index 65bc20613..de88298d1 100644 --- a/server/tests/api/check-params/video-channels.ts +++ b/server/tests/api/check-params/video-channels.ts | |||
@@ -24,6 +24,7 @@ import { | |||
24 | checkBadStartPagination | 24 | checkBadStartPagination |
25 | } from '../../../../shared/extra-utils/requests/check-api-params' | 25 | } from '../../../../shared/extra-utils/requests/check-api-params' |
26 | import { join } from 'path' | 26 | import { join } from 'path' |
27 | import { VideoChannelUpdate } from '../../../../shared/models/videos' | ||
27 | 28 | ||
28 | const expect = chai.expect | 29 | const expect = chai.expect |
29 | 30 | ||
@@ -67,8 +68,30 @@ describe('Test video channels API validator', function () { | |||
67 | }) | 68 | }) |
68 | 69 | ||
69 | describe('When listing account video channels', function () { | 70 | describe('When listing account video channels', function () { |
71 | const accountChannelPath = '/api/v1/accounts/fake/video-channels' | ||
72 | |||
73 | it('Should fail with a bad start pagination', async function () { | ||
74 | await checkBadStartPagination(server.url, accountChannelPath, server.accessToken) | ||
75 | }) | ||
76 | |||
77 | it('Should fail with a bad count pagination', async function () { | ||
78 | await checkBadCountPagination(server.url, accountChannelPath, server.accessToken) | ||
79 | }) | ||
80 | |||
81 | it('Should fail with an incorrect sort', async function () { | ||
82 | await checkBadSortPagination(server.url, accountChannelPath, server.accessToken) | ||
83 | }) | ||
84 | |||
70 | it('Should fail with a unknown account', async function () { | 85 | it('Should fail with a unknown account', async function () { |
71 | await getAccountVideoChannelsList(server.url, 'unknown', 404) | 86 | await getAccountVideoChannelsList({ url: server.url, accountName: 'unknown', specialStatus: 404 }) |
87 | }) | ||
88 | |||
89 | it('Should succeed with the correct parameters', async function () { | ||
90 | await makeGetRequest({ | ||
91 | url: server.url, | ||
92 | path: accountChannelPath, | ||
93 | statusCodeExpected: 200 | ||
94 | }) | ||
72 | }) | 95 | }) |
73 | }) | 96 | }) |
74 | 97 | ||
@@ -147,9 +170,11 @@ describe('Test video channels API validator', function () { | |||
147 | }) | 170 | }) |
148 | 171 | ||
149 | describe('When updating a video channel', function () { | 172 | describe('When updating a video channel', function () { |
150 | const baseCorrectParams = { | 173 | const baseCorrectParams: VideoChannelUpdate = { |
151 | displayName: 'hello', | 174 | displayName: 'hello', |
152 | description: 'super description' | 175 | description: 'super description', |
176 | support: 'toto', | ||
177 | bulkVideosSupportUpdate: false | ||
153 | } | 178 | } |
154 | let path: string | 179 | let path: string |
155 | 180 | ||
@@ -192,6 +217,11 @@ describe('Test video channels API validator', function () { | |||
192 | await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 217 | await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
193 | }) | 218 | }) |
194 | 219 | ||
220 | it('Should fail with a bad bulkVideosSupportUpdate field', async function () { | ||
221 | const fields = immutableAssign(baseCorrectParams, { bulkVideosSupportUpdate: 'super' }) | ||
222 | await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | ||
223 | }) | ||
224 | |||
195 | it('Should succeed with the correct parameters', async function () { | 225 | it('Should succeed with the correct parameters', async function () { |
196 | await makePutBodyRequest({ | 226 | await makePutBodyRequest({ |
197 | url: server.url, | 227 | url: server.url, |