aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/redundancy.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-28 17:30:59 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-06-29 14:56:35 +0200
commitd4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb (patch)
treea4cb07318100031951c3dffc61f4f2cb95d2cbd0 /server/tests/api/check-params/redundancy.ts
parent62ddc31a9e4b92d7d27898ccfc363f68ab044139 (diff)
downloadPeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.gz
PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.zst
PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.zip
Support short uuid for GET video/playlist
Diffstat (limited to 'server/tests/api/check-params/redundancy.ts')
-rw-r--r--server/tests/api/check-params/redundancy.ts38
1 files changed, 28 insertions, 10 deletions
diff --git a/server/tests/api/check-params/redundancy.ts b/server/tests/api/check-params/redundancy.ts
index 71be50a6f..dac6938de 100644
--- a/server/tests/api/check-params/redundancy.ts
+++ b/server/tests/api/check-params/redundancy.ts
@@ -1,7 +1,8 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4 4import { VideoCreateResult } from '@shared/models'
5import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
5import { 6import {
6 checkBadCountPagination, 7 checkBadCountPagination,
7 checkBadSortPagination, 8 checkBadSortPagination,
@@ -9,20 +10,24 @@ import {
9 cleanupTests, 10 cleanupTests,
10 createUser, 11 createUser,
11 doubleFollow, 12 doubleFollow,
12 flushAndRunMultipleServers, makeDeleteRequest, 13 flushAndRunMultipleServers,
13 makeGetRequest, makePostBodyRequest, 14 getVideo,
15 makeDeleteRequest,
16 makeGetRequest,
17 makePostBodyRequest,
14 makePutBodyRequest, 18 makePutBodyRequest,
15 ServerInfo, 19 ServerInfo,
16 setAccessTokensToServers, uploadVideoAndGetId, 20 setAccessTokensToServers,
17 userLogin, waitJobs, getVideoIdFromUUID 21 uploadVideoAndGetId,
22 userLogin,
23 waitJobs
18} from '../../../../shared/extra-utils' 24} from '../../../../shared/extra-utils'
19import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
20 25
21describe('Test server redundancy API validators', function () { 26describe('Test server redundancy API validators', function () {
22 let servers: ServerInfo[] 27 let servers: ServerInfo[]
23 let userAccessToken = null 28 let userAccessToken = null
24 let videoIdLocal: number 29 let videoIdLocal: number
25 let videoIdRemote: number 30 let videoRemote: VideoCreateResult
26 31
27 // --------------------------------------------------------------- 32 // ---------------------------------------------------------------
28 33
@@ -48,7 +53,8 @@ describe('Test server redundancy API validators', function () {
48 53
49 await waitJobs(servers) 54 await waitJobs(servers)
50 55
51 videoIdRemote = await getVideoIdFromUUID(servers[0].url, remoteUUID) 56 const resVideo = await getVideo(servers[0].url, remoteUUID)
57 videoRemote = resVideo.body
52 }) 58 })
53 59
54 describe('When listing redundancies', function () { 60 describe('When listing redundancies', function () {
@@ -131,7 +137,13 @@ describe('Test server redundancy API validators', function () {
131 }) 137 })
132 138
133 it('Should succeed with the correct params', async function () { 139 it('Should succeed with the correct params', async function () {
134 await makePostBodyRequest({ url, path, token, fields: { videoId: videoIdRemote }, statusCodeExpected: HttpStatusCode.NO_CONTENT_204 }) 140 await makePostBodyRequest({
141 url,
142 path,
143 token,
144 fields: { videoId: videoRemote.shortUUID },
145 statusCodeExpected: HttpStatusCode.NO_CONTENT_204
146 })
135 }) 147 })
136 148
137 it('Should fail if the video is already duplicated', async function () { 149 it('Should fail if the video is already duplicated', async function () {
@@ -139,7 +151,13 @@ describe('Test server redundancy API validators', function () {
139 151
140 await waitJobs(servers) 152 await waitJobs(servers)
141 153
142 await makePostBodyRequest({ url, path, token, fields: { videoId: videoIdRemote }, statusCodeExpected: HttpStatusCode.CONFLICT_409 }) 154 await makePostBodyRequest({
155 url,
156 path,
157 token,
158 fields: { videoId: videoRemote.uuid },
159 statusCodeExpected: HttpStatusCode.CONFLICT_409
160 })
143 }) 161 })
144 }) 162 })
145 163