aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/users.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params/users.ts')
-rw-r--r--server/tests/api/check-params/users.ts22
1 files changed, 21 insertions, 1 deletions
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index 0c126dbff..44412ad82 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -2,11 +2,13 @@
2 2
3import { omit } from 'lodash' 3import { omit } from 'lodash'
4import 'mocha' 4import 'mocha'
5import { join } from "path"
5import { UserRole } from '../../../../shared' 6import { UserRole } from '../../../../shared'
6 7
7import { 8import {
8 createUser, flushTests, getMyUserInformation, getMyUserVideoRating, getUsersList, immutableAssign, killallServers, makeGetRequest, 9 createUser, flushTests, getMyUserInformation, getMyUserVideoRating, getUsersList, immutableAssign, killallServers, makeGetRequest,
9 makePostBodyRequest, makePutBodyRequest, registerUser, removeUser, runServer, ServerInfo, setAccessTokensToServers, updateUser, 10 makePostBodyRequest, makePostUploadRequest, makePutBodyRequest, registerUser, removeUser, runServer, ServerInfo, setAccessTokensToServers,
11 updateUser,
10 uploadVideo, userLogin 12 uploadVideo, userLogin
11} from '../../utils' 13} from '../../utils'
12import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' 14import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
@@ -266,6 +268,24 @@ describe('Test users API validators', function () {
266 }) 268 })
267 }) 269 })
268 270
271 describe('When updating my avatar', function () {
272 it('Should fail without an incorrect input file', async function () {
273 const fields = {}
274 const attaches = {
275 'avatarfile': join(__dirname, '..', 'fixtures', 'video_short.mp4')
276 }
277 await makePostUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches })
278 })
279
280 it('Should succeed with the correct params', async function () {
281 const fields = {}
282 const attaches = {
283 'avatarfile': join(__dirname, '..', 'fixtures', 'avatar.png')
284 }
285 await makePostUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches })
286 })
287 })
288
269 describe('When updating a user', function () { 289 describe('When updating a user', function () {
270 290
271 before(async function () { 291 before(async function () {