aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/videos.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params/videos.ts')
-rw-r--r--server/tests/api/check-params/videos.ts36
1 files changed, 18 insertions, 18 deletions
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index c60de2640..e11ca0c82 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -4,7 +4,7 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { omit } from 'lodash' 5import { omit } from 'lodash'
6import { join } from 'path' 6import { join } from 'path'
7import { HttpStatusCode, randomInt } from '@shared/core-utils' 7import { randomInt } from '@shared/core-utils'
8import { 8import {
9 checkBadCountPagination, 9 checkBadCountPagination,
10 checkBadSortPagination, 10 checkBadSortPagination,
@@ -16,11 +16,11 @@ import {
16 makeGetRequest, 16 makeGetRequest,
17 makePutBodyRequest, 17 makePutBodyRequest,
18 makeUploadRequest, 18 makeUploadRequest,
19 root,
20 PeerTubeServer, 19 PeerTubeServer,
20 root,
21 setAccessTokensToServers 21 setAccessTokensToServers
22} from '@shared/extra-utils' 22} from '@shared/extra-utils'
23import { PeerTubeProblemDocument, VideoCreateResult, VideoPrivacy } from '@shared/models' 23import { HttpStatusCode, PeerTubeProblemDocument, VideoCreateResult, VideoPrivacy } from '@shared/models'
24 24
25const expect = chai.expect 25const expect = chai.expect
26 26
@@ -69,11 +69,11 @@ describe('Test videos API validator', function () {
69 }) 69 })
70 70
71 it('Should fail with a bad skipVideos query', async function () { 71 it('Should fail with a bad skipVideos query', async function () {
72 await makeGetRequest({ url: server.url, path, statusCodeExpected: HttpStatusCode.OK_200, query: { skipCount: 'toto' } }) 72 await makeGetRequest({ url: server.url, path, expectedStatus: HttpStatusCode.OK_200, query: { skipCount: 'toto' } })
73 }) 73 })
74 74
75 it('Should success with the correct parameters', async function () { 75 it('Should success with the correct parameters', async function () {
76 await makeGetRequest({ url: server.url, path, statusCodeExpected: HttpStatusCode.OK_200, query: { skipCount: false } }) 76 await makeGetRequest({ url: server.url, path, expectedStatus: HttpStatusCode.OK_200, query: { skipCount: false } })
77 }) 77 })
78 }) 78 })
79 79
@@ -83,7 +83,7 @@ describe('Test videos API validator', function () {
83 await makeGetRequest({ 83 await makeGetRequest({
84 url: server.url, 84 url: server.url,
85 path: join(path, 'search'), 85 path: join(path, 'search'),
86 statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 86 expectedStatus: HttpStatusCode.BAD_REQUEST_400
87 }) 87 })
88 }) 88 })
89 89
@@ -100,7 +100,7 @@ describe('Test videos API validator', function () {
100 }) 100 })
101 101
102 it('Should success with the correct parameters', async function () { 102 it('Should success with the correct parameters', async function () {
103 await makeGetRequest({ url: server.url, path, statusCodeExpected: HttpStatusCode.OK_200 }) 103 await makeGetRequest({ url: server.url, path, expectedStatus: HttpStatusCode.OK_200 })
104 }) 104 })
105 }) 105 })
106 106
@@ -120,7 +120,7 @@ describe('Test videos API validator', function () {
120 }) 120 })
121 121
122 it('Should success with the correct parameters', async function () { 122 it('Should success with the correct parameters', async function () {
123 await makeGetRequest({ url: server.url, token: server.accessToken, path, statusCodeExpected: HttpStatusCode.OK_200 }) 123 await makeGetRequest({ url: server.url, token: server.accessToken, path, expectedStatus: HttpStatusCode.OK_200 })
124 }) 124 })
125 }) 125 })
126 126
@@ -144,7 +144,7 @@ describe('Test videos API validator', function () {
144 }) 144 })
145 145
146 it('Should success with the correct parameters', async function () { 146 it('Should success with the correct parameters', async function () {
147 await makeGetRequest({ url: server.url, path, statusCodeExpected: HttpStatusCode.OK_200 }) 147 await makeGetRequest({ url: server.url, path, expectedStatus: HttpStatusCode.OK_200 })
148 }) 148 })
149 }) 149 })
150 150
@@ -168,7 +168,7 @@ describe('Test videos API validator', function () {
168 }) 168 })
169 169
170 it('Should success with the correct parameters', async function () { 170 it('Should success with the correct parameters', async function () {
171 await makeGetRequest({ url: server.url, path, statusCodeExpected: HttpStatusCode.OK_200 }) 171 await makeGetRequest({ url: server.url, path, expectedStatus: HttpStatusCode.OK_200 })
172 }) 172 })
173 }) 173 })
174 174
@@ -506,7 +506,7 @@ describe('Test videos API validator', function () {
506 path: path + '4da6fde3-88f7-4d16-b119-108df5630b06', 506 path: path + '4da6fde3-88f7-4d16-b119-108df5630b06',
507 token: server.accessToken, 507 token: server.accessToken,
508 fields, 508 fields,
509 statusCodeExpected: HttpStatusCode.NOT_FOUND_404 509 expectedStatus: HttpStatusCode.NOT_FOUND_404
510 }) 510 })
511 }) 511 })
512 512
@@ -660,7 +660,7 @@ describe('Test videos API validator', function () {
660 path: path + video.shortUUID, 660 path: path + video.shortUUID,
661 token: userAccessToken, 661 token: userAccessToken,
662 fields, 662 fields,
663 statusCodeExpected: HttpStatusCode.FORBIDDEN_403 663 expectedStatus: HttpStatusCode.FORBIDDEN_403
664 }) 664 })
665 }) 665 })
666 666
@@ -692,7 +692,7 @@ describe('Test videos API validator', function () {
692 path: path + video.shortUUID, 692 path: path + video.shortUUID,
693 token: server.accessToken, 693 token: server.accessToken,
694 fields, 694 fields,
695 statusCodeExpected: HttpStatusCode.NO_CONTENT_204 695 expectedStatus: HttpStatusCode.NO_CONTENT_204
696 }) 696 })
697 }) 697 })
698 }) 698 })
@@ -702,7 +702,7 @@ describe('Test videos API validator', function () {
702 const res = await makeGetRequest({ 702 const res = await makeGetRequest({
703 url: server.url, 703 url: server.url,
704 path, 704 path,
705 statusCodeExpected: HttpStatusCode.OK_200 705 expectedStatus: HttpStatusCode.OK_200
706 }) 706 })
707 707
708 expect(res.body.data).to.be.an('array') 708 expect(res.body.data).to.be.an('array')
@@ -762,7 +762,7 @@ describe('Test videos API validator', function () {
762 path: path + '4da6fde3-88f7-4d16-b119-108df5630b06/rate', 762 path: path + '4da6fde3-88f7-4d16-b119-108df5630b06/rate',
763 token: server.accessToken, 763 token: server.accessToken,
764 fields, 764 fields,
765 statusCodeExpected: HttpStatusCode.NOT_FOUND_404 765 expectedStatus: HttpStatusCode.NOT_FOUND_404
766 }) 766 })
767 }) 767 })
768 768
@@ -782,7 +782,7 @@ describe('Test videos API validator', function () {
782 path: path + videoId + '/rate', 782 path: path + videoId + '/rate',
783 token: server.accessToken, 783 token: server.accessToken,
784 fields, 784 fields,
785 statusCodeExpected: HttpStatusCode.NO_CONTENT_204 785 expectedStatus: HttpStatusCode.NO_CONTENT_204
786 }) 786 })
787 }) 787 })
788 }) 788 })
@@ -792,7 +792,7 @@ describe('Test videos API validator', function () {
792 await makeDeleteRequest({ 792 await makeDeleteRequest({
793 url: server.url, 793 url: server.url,
794 path, 794 path,
795 statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 795 expectedStatus: HttpStatusCode.BAD_REQUEST_400
796 }) 796 })
797 }) 797 })
798 798
@@ -812,7 +812,7 @@ describe('Test videos API validator', function () {
812 812
813 it('Shoud report the appropriate error', async function () { 813 it('Shoud report the appropriate error', async function () {
814 const body = await server.videos.remove({ id: 'hello', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 814 const body = await server.videos.remove({ id: 'hello', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
815 const error = body as unknown as PeerTubeProblemDocument 815 const error = body as PeerTubeProblemDocument
816 816
817 expect(error.docs).to.equal('https://docs.joinpeertube.org/api-rest-reference.html#operation/delVideo') 817 expect(error.docs).to.equal('https://docs.joinpeertube.org/api-rest-reference.html#operation/delVideo')
818 818