aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/video-channels.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-13 09:43:59 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit6c5065a011b099618681a37bd77eaa7bd3db752e (patch)
tree352252a00b25013c4b1902f6bcd9668aba295c7b /server/tests/api/check-params/video-channels.ts
parent0d8ecb7592577f54012413a2b5a9b159cfc90399 (diff)
downloadPeerTube-6c5065a011b099618681a37bd77eaa7bd3db752e.tar.gz
PeerTube-6c5065a011b099618681a37bd77eaa7bd3db752e.tar.zst
PeerTube-6c5065a011b099618681a37bd77eaa7bd3db752e.zip
Introduce server commands
Diffstat (limited to 'server/tests/api/check-params/video-channels.ts')
-rw-r--r--server/tests/api/check-params/video-channels.ts31
1 files changed, 14 insertions, 17 deletions
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts
index d29346dc3..3b72d3796 100644
--- a/server/tests/api/check-params/video-channels.ts
+++ b/server/tests/api/check-params/video-channels.ts
@@ -3,14 +3,16 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { omit } from 'lodash' 5import { omit } from 'lodash'
6import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 6import { HttpStatusCode } from '@shared/core-utils'
7import { 7import {
8 buildAbsoluteFixturePath, 8 buildAbsoluteFixturePath,
9 ChannelsCommand, 9 ChannelsCommand,
10 checkBadCountPagination,
11 checkBadSortPagination,
12 checkBadStartPagination,
10 cleanupTests, 13 cleanupTests,
11 createUser, 14 createUser,
12 flushAndRunServer, 15 flushAndRunServer,
13 immutableAssign,
14 makeGetRequest, 16 makeGetRequest,
15 makePostBodyRequest, 17 makePostBodyRequest,
16 makePutBodyRequest, 18 makePutBodyRequest,
@@ -18,13 +20,8 @@ import {
18 ServerInfo, 20 ServerInfo,
19 setAccessTokensToServers, 21 setAccessTokensToServers,
20 userLogin 22 userLogin
21} from '../../../../shared/extra-utils' 23} from '@shared/extra-utils'
22import { 24import { VideoChannelUpdate } from '@shared/models'
23 checkBadCountPagination,
24 checkBadSortPagination,
25 checkBadStartPagination
26} from '../../../../shared/extra-utils/requests/check-api-params'
27import { VideoChannelUpdate } from '../../../../shared/models/videos'
28 25
29const expect = chai.expect 26const expect = chai.expect
30 27
@@ -127,7 +124,7 @@ describe('Test video channels API validator', function () {
127 }) 124 })
128 125
129 it('Should fail with a bad name', async function () { 126 it('Should fail with a bad name', async function () {
130 const fields = immutableAssign(baseCorrectParams, { name: 'super name' }) 127 const fields = { ...baseCorrectParams, name: 'super name' }
131 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields }) 128 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields })
132 }) 129 })
133 130
@@ -137,17 +134,17 @@ describe('Test video channels API validator', function () {
137 }) 134 })
138 135
139 it('Should fail with a long name', async function () { 136 it('Should fail with a long name', async function () {
140 const fields = immutableAssign(baseCorrectParams, { displayName: 'super'.repeat(25) }) 137 const fields = { ...baseCorrectParams, displayName: 'super'.repeat(25) }
141 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields }) 138 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields })
142 }) 139 })
143 140
144 it('Should fail with a long description', async function () { 141 it('Should fail with a long description', async function () {
145 const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(201) }) 142 const fields = { ...baseCorrectParams, description: 'super'.repeat(201) }
146 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields }) 143 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields })
147 }) 144 })
148 145
149 it('Should fail with a long support text', async function () { 146 it('Should fail with a long support text', async function () {
150 const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(201) }) 147 const fields = { ...baseCorrectParams, support: 'super'.repeat(201) }
151 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields }) 148 await makePostBodyRequest({ url: server.url, path: videoChannelPath, token: server.accessToken, fields })
152 }) 149 })
153 150
@@ -206,22 +203,22 @@ describe('Test video channels API validator', function () {
206 }) 203 })
207 204
208 it('Should fail with a long name', async function () { 205 it('Should fail with a long name', async function () {
209 const fields = immutableAssign(baseCorrectParams, { displayName: 'super'.repeat(25) }) 206 const fields = { ...baseCorrectParams, displayName: 'super'.repeat(25) }
210 await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields }) 207 await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields })
211 }) 208 })
212 209
213 it('Should fail with a long description', async function () { 210 it('Should fail with a long description', async function () {
214 const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(201) }) 211 const fields = { ...baseCorrectParams, description: 'super'.repeat(201) }
215 await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields }) 212 await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields })
216 }) 213 })
217 214
218 it('Should fail with a long support text', async function () { 215 it('Should fail with a long support text', async function () {
219 const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(201) }) 216 const fields = { ...baseCorrectParams, support: 'super'.repeat(201) }
220 await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields }) 217 await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields })
221 }) 218 })
222 219
223 it('Should fail with a bad bulkVideosSupportUpdate field', async function () { 220 it('Should fail with a bad bulkVideosSupportUpdate field', async function () {
224 const fields = immutableAssign(baseCorrectParams, { bulkVideosSupportUpdate: 'super' }) 221 const fields = { ...baseCorrectParams, bulkVideosSupportUpdate: 'super' }
225 await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields }) 222 await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields })
226 }) 223 })
227 224