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, 12 insertions, 10 deletions
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index dcff0d52b..70a872ce5 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -2,12 +2,12 @@
2 2
3import 'mocha' 3import 'mocha'
4import { omit } from 'lodash' 4import { omit } from 'lodash'
5import { join } from 'path' 5import { User, UserRole, VideoCreateResult } from '../../../../shared'
6import { User, UserRole } from '../../../../shared'
7import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 6import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
8import { 7import {
9 addVideoChannel, 8 addVideoChannel,
10 blockUser, 9 blockUser,
10 buildAbsoluteFixturePath,
11 cleanupTests, 11 cleanupTests,
12 createUser, 12 createUser,
13 deleteMe, 13 deleteMe,
@@ -45,7 +45,7 @@ describe('Test users API validators', function () {
45 let userId: number 45 let userId: number
46 let rootId: number 46 let rootId: number
47 let moderatorId: number 47 let moderatorId: number
48 let videoId: number 48 let video: VideoCreateResult
49 let server: ServerInfo 49 let server: ServerInfo
50 let serverWithRegistrationDisabled: ServerInfo 50 let serverWithRegistrationDisabled: ServerInfo
51 let userAccessToken = '' 51 let userAccessToken = ''
@@ -126,7 +126,7 @@ describe('Test users API validators', function () {
126 126
127 { 127 {
128 const res = await uploadVideo(server.url, server.accessToken, {}) 128 const res = await uploadVideo(server.url, server.accessToken, {})
129 videoId = res.body.video.id 129 video = res.body.video
130 } 130 }
131 131
132 { 132 {
@@ -600,7 +600,7 @@ describe('Test users API validators', function () {
600 it('Should fail without an incorrect input file', async function () { 600 it('Should fail without an incorrect input file', async function () {
601 const fields = {} 601 const fields = {}
602 const attaches = { 602 const attaches = {
603 avatarfile: join(__dirname, '..', '..', 'fixtures', 'video_short.mp4') 603 avatarfile: buildAbsoluteFixturePath('video_short.mp4')
604 } 604 }
605 await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches }) 605 await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches })
606 }) 606 })
@@ -608,7 +608,7 @@ describe('Test users API validators', function () {
608 it('Should fail with a big file', async function () { 608 it('Should fail with a big file', async function () {
609 const fields = {} 609 const fields = {}
610 const attaches = { 610 const attaches = {
611 avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') 611 avatarfile: buildAbsoluteFixturePath('avatar-big.png')
612 } 612 }
613 await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches }) 613 await makeUploadRequest({ url: server.url, path: path + '/me/avatar/pick', token: server.accessToken, fields, attaches })
614 }) 614 })
@@ -616,7 +616,7 @@ describe('Test users API validators', function () {
616 it('Should fail with an unauthenticated user', async function () { 616 it('Should fail with an unauthenticated user', async function () {
617 const fields = {} 617 const fields = {}
618 const attaches = { 618 const attaches = {
619 avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') 619 avatarfile: buildAbsoluteFixturePath('avatar.png')
620 } 620 }
621 await makeUploadRequest({ 621 await makeUploadRequest({
622 url: server.url, 622 url: server.url,
@@ -630,7 +630,7 @@ describe('Test users API validators', function () {
630 it('Should succeed with the correct params', async function () { 630 it('Should succeed with the correct params', async function () {
631 const fields = {} 631 const fields = {}
632 const attaches = { 632 const attaches = {
633 avatarfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') 633 avatarfile: buildAbsoluteFixturePath('avatar.png')
634 } 634 }
635 await makeUploadRequest({ 635 await makeUploadRequest({
636 url: server.url, 636 url: server.url,
@@ -829,7 +829,7 @@ describe('Test users API validators', function () {
829 829
830 describe('When getting my video rating', function () { 830 describe('When getting my video rating', function () {
831 it('Should fail with a non authenticated user', async function () { 831 it('Should fail with a non authenticated user', async function () {
832 await getMyUserVideoRating(server.url, 'fake_token', videoId, HttpStatusCode.UNAUTHORIZED_401) 832 await getMyUserVideoRating(server.url, 'fake_token', video.id, HttpStatusCode.UNAUTHORIZED_401)
833 }) 833 })
834 834
835 it('Should fail with an incorrect video uuid', async function () { 835 it('Should fail with an incorrect video uuid', async function () {
@@ -841,7 +841,9 @@ describe('Test users API validators', function () {
841 }) 841 })
842 842
843 it('Should succeed with the correct parameters', async function () { 843 it('Should succeed with the correct parameters', async function () {
844 await getMyUserVideoRating(server.url, server.accessToken, videoId) 844 await getMyUserVideoRating(server.url, server.accessToken, video.id)
845 await getMyUserVideoRating(server.url, server.accessToken, video.uuid)
846 await getMyUserVideoRating(server.url, server.accessToken, video.shortUUID)
845 }) 847 })
846 }) 848 })
847 849