diff options
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r-- | server/tests/api/check-params/users.ts | 8 | ||||
-rw-r--r-- | server/tests/api/check-params/video-channels.ts | 15 | ||||
-rw-r--r-- | server/tests/api/check-params/videos.ts | 18 |
3 files changed, 37 insertions, 4 deletions
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts index d9dea0713..ee591d620 100644 --- a/server/tests/api/check-params/users.ts +++ b/server/tests/api/check-params/users.ts | |||
@@ -255,6 +255,14 @@ describe('Test users API validators', function () { | |||
255 | await makePutBodyRequest({ url: server.url, path: path + 'me', token: 'super token', fields, statusCodeExpected: 401 }) | 255 | await makePutBodyRequest({ url: server.url, path: path + 'me', token: 'super token', fields, statusCodeExpected: 401 }) |
256 | }) | 256 | }) |
257 | 257 | ||
258 | it('Should fail with a too long description', async function () { | ||
259 | const fields = { | ||
260 | description: 'super'.repeat(60) | ||
261 | } | ||
262 | |||
263 | await makePutBodyRequest({ url: server.url, path: path + 'me', token: userAccessToken, fields }) | ||
264 | }) | ||
265 | |||
258 | it('Should succeed with the correct params', async function () { | 266 | it('Should succeed with the correct params', async function () { |
259 | const fields = { | 267 | const fields = { |
260 | password: 'my super password', | 268 | password: 'my super password', |
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts index d073e28f0..43c5462ee 100644 --- a/server/tests/api/check-params/video-channels.ts +++ b/server/tests/api/check-params/video-channels.ts | |||
@@ -62,7 +62,8 @@ describe('Test videos API validator', function () { | |||
62 | describe('When adding a video channel', function () { | 62 | describe('When adding a video channel', function () { |
63 | const baseCorrectParams = { | 63 | const baseCorrectParams = { |
64 | name: 'hello', | 64 | name: 'hello', |
65 | description: 'super description' | 65 | description: 'super description', |
66 | support: 'super support text' | ||
66 | } | 67 | } |
67 | 68 | ||
68 | it('Should fail with a non authenticated user', async function () { | 69 | it('Should fail with a non authenticated user', async function () { |
@@ -89,13 +90,18 @@ describe('Test videos API validator', function () { | |||
89 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 90 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
90 | }) | 91 | }) |
91 | 92 | ||
93 | it('Should fail with a long support text', async function () { | ||
94 | const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(70) }) | ||
95 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | ||
96 | }) | ||
97 | |||
92 | it('Should succeed with the correct parameters', async function () { | 98 | it('Should succeed with the correct parameters', async function () { |
93 | await makePostBodyRequest({ | 99 | await makePostBodyRequest({ |
94 | url: server.url, | 100 | url: server.url, |
95 | path, | 101 | path, |
96 | token: server.accessToken, | 102 | token: server.accessToken, |
97 | fields: baseCorrectParams, | 103 | fields: baseCorrectParams, |
98 | statusCodeExpected: 204 | 104 | statusCodeExpected: 200 |
99 | }) | 105 | }) |
100 | }) | 106 | }) |
101 | }) | 107 | }) |
@@ -143,6 +149,11 @@ describe('Test videos API validator', function () { | |||
143 | await makePutBodyRequest({ url: server.url, path: path + '/' + videoChannelId, token: server.accessToken, fields }) | 149 | await makePutBodyRequest({ url: server.url, path: path + '/' + videoChannelId, token: server.accessToken, fields }) |
144 | }) | 150 | }) |
145 | 151 | ||
152 | it('Should fail with a long support text', async function () { | ||
153 | const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(70) }) | ||
154 | await makePutBodyRequest({ url: server.url, path: path + '/' + videoChannelId, token: server.accessToken, fields }) | ||
155 | }) | ||
156 | |||
146 | it('Should succeed with the correct parameters', async function () { | 157 | it('Should succeed with the correct parameters', async function () { |
147 | await makePutBodyRequest({ | 158 | await makePutBodyRequest({ |
148 | url: server.url, | 159 | url: server.url, |
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index aa30b721b..1d5c8543d 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts | |||
@@ -102,6 +102,7 @@ describe('Test videos API validator', function () { | |||
102 | nsfw: false, | 102 | nsfw: false, |
103 | commentsEnabled: true, | 103 | commentsEnabled: true, |
104 | description: 'my super description', | 104 | description: 'my super description', |
105 | support: 'my super support text', | ||
105 | tags: [ 'tag1', 'tag2' ], | 106 | tags: [ 'tag1', 'tag2' ], |
106 | privacy: VideoPrivacy.PUBLIC, | 107 | privacy: VideoPrivacy.PUBLIC, |
107 | channelId | 108 | channelId |
@@ -178,7 +179,14 @@ describe('Test videos API validator', function () { | |||
178 | }) | 179 | }) |
179 | 180 | ||
180 | it('Should fail with a long description', async function () { | 181 | it('Should fail with a long description', async function () { |
181 | const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(1500) }) | 182 | const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(2500) }) |
183 | const attaches = baseCorrectAttaches | ||
184 | |||
185 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | ||
186 | }) | ||
187 | |||
188 | it('Should fail with a long support text', async function () { | ||
189 | const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(70) }) | ||
182 | const attaches = baseCorrectAttaches | 190 | const attaches = baseCorrectAttaches |
183 | 191 | ||
184 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) | 192 | await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) |
@@ -417,7 +425,13 @@ describe('Test videos API validator', function () { | |||
417 | }) | 425 | }) |
418 | 426 | ||
419 | it('Should fail with a long description', async function () { | 427 | it('Should fail with a long description', async function () { |
420 | const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(1500) }) | 428 | const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(2500) }) |
429 | |||
430 | await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) | ||
431 | }) | ||
432 | |||
433 | it('Should fail with a long support text', async function () { | ||
434 | const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(70) }) | ||
421 | 435 | ||
422 | await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) | 436 | await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) |
423 | }) | 437 | }) |