aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/live/live-save-replay.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2020-12-08 21:16:10 +0100
committerGitHub <noreply@github.com>2020-12-08 21:16:10 +0100
commitf2eb23cd87cf32b8fe545178143b5f49e06a58da (patch)
treeaf7d59945af70e28fd85047e2c688c59a908f548 /server/tests/api/live/live-save-replay.ts
parentc977fd3ec931c059111ddb2b8d6ddbb20b6b99a1 (diff)
downloadPeerTube-f2eb23cd87cf32b8fe545178143b5f49e06a58da.tar.gz
PeerTube-f2eb23cd87cf32b8fe545178143b5f49e06a58da.tar.zst
PeerTube-f2eb23cd87cf32b8fe545178143b5f49e06a58da.zip
emit more specific status codes on video upload (#3423)
- reduce http status codes list to potentially useful codes - convert more codes to typed ones - factorize html generator for error responses
Diffstat (limited to 'server/tests/api/live/live-save-replay.ts')
-rw-r--r--server/tests/api/live/live-save-replay.ts33
1 files changed, 17 insertions, 16 deletions
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts
index 3ffa0c093..e300ec345 100644
--- a/server/tests/api/live/live-save-replay.ts
+++ b/server/tests/api/live/live-save-replay.ts
@@ -25,6 +25,7 @@ import {
25 waitJobs, 25 waitJobs,
26 waitUntilLiveStarts 26 waitUntilLiveStarts
27} from '../../../../shared/extra-utils' 27} from '../../../../shared/extra-utils'
28import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
28 29
29const expect = chai.expect 30const expect = chai.expect
30 31
@@ -118,7 +119,7 @@ describe('Save replay setting', function () {
118 119
119 await waitJobs(servers) 120 await waitJobs(servers)
120 121
121 await checkVideosExist(liveVideoUUID, false, 200) 122 await checkVideosExist(liveVideoUUID, false, HttpStatusCode.OK_200)
122 await checkVideoState(liveVideoUUID, VideoState.WAITING_FOR_LIVE) 123 await checkVideoState(liveVideoUUID, VideoState.WAITING_FOR_LIVE)
123 }) 124 })
124 125
@@ -130,7 +131,7 @@ describe('Save replay setting', function () {
130 131
131 await waitJobs(servers) 132 await waitJobs(servers)
132 133
133 await checkVideosExist(liveVideoUUID, true, 200) 134 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
134 await checkVideoState(liveVideoUUID, VideoState.PUBLISHED) 135 await checkVideoState(liveVideoUUID, VideoState.PUBLISHED)
135 }) 136 })
136 137
@@ -142,7 +143,7 @@ describe('Save replay setting', function () {
142 await waitJobs(servers) 143 await waitJobs(servers)
143 144
144 // Live still exist, but cannot be played anymore 145 // Live still exist, but cannot be played anymore
145 await checkVideosExist(liveVideoUUID, false, 200) 146 await checkVideosExist(liveVideoUUID, false, HttpStatusCode.OK_200)
146 await checkVideoState(liveVideoUUID, VideoState.LIVE_ENDED) 147 await checkVideoState(liveVideoUUID, VideoState.LIVE_ENDED)
147 148
148 // No resolutions saved since we did not save replay 149 // No resolutions saved since we did not save replay
@@ -158,7 +159,7 @@ describe('Save replay setting', function () {
158 await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoUUID) 159 await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoUUID)
159 160
160 await waitJobs(servers) 161 await waitJobs(servers)
161 await checkVideosExist(liveVideoUUID, true, 200) 162 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
162 163
163 await Promise.all([ 164 await Promise.all([
164 addVideoToBlacklist(servers[0].url, servers[0].accessToken, liveVideoUUID, 'bad live', true), 165 addVideoToBlacklist(servers[0].url, servers[0].accessToken, liveVideoUUID, 'bad live', true),
@@ -169,8 +170,8 @@ describe('Save replay setting', function () {
169 170
170 await checkVideosExist(liveVideoUUID, false) 171 await checkVideosExist(liveVideoUUID, false)
171 172
172 await getVideo(servers[0].url, liveVideoUUID, 401) 173 await getVideo(servers[0].url, liveVideoUUID, HttpStatusCode.UNAUTHORIZED_401)
173 await getVideo(servers[1].url, liveVideoUUID, 404) 174 await getVideo(servers[1].url, liveVideoUUID, HttpStatusCode.NOT_FOUND_404)
174 175
175 await checkLiveCleanup(servers[0], liveVideoUUID, []) 176 await checkLiveCleanup(servers[0], liveVideoUUID, [])
176 }) 177 })
@@ -184,7 +185,7 @@ describe('Save replay setting', function () {
184 await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoUUID) 185 await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoUUID)
185 186
186 await waitJobs(servers) 187 await waitJobs(servers)
187 await checkVideosExist(liveVideoUUID, true, 200) 188 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
188 189
189 await Promise.all([ 190 await Promise.all([
190 testFfmpegStreamError(ffmpegCommand, true), 191 testFfmpegStreamError(ffmpegCommand, true),
@@ -193,7 +194,7 @@ describe('Save replay setting', function () {
193 194
194 await waitJobs(servers) 195 await waitJobs(servers)
195 196
196 await checkVideosExist(liveVideoUUID, false, 404) 197 await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404)
197 await checkLiveCleanup(servers[0], liveVideoUUID, []) 198 await checkLiveCleanup(servers[0], liveVideoUUID, [])
198 }) 199 })
199 }) 200 })
@@ -207,7 +208,7 @@ describe('Save replay setting', function () {
207 208
208 await waitJobs(servers) 209 await waitJobs(servers)
209 210
210 await checkVideosExist(liveVideoUUID, false, 200) 211 await checkVideosExist(liveVideoUUID, false, HttpStatusCode.OK_200)
211 await checkVideoState(liveVideoUUID, VideoState.WAITING_FOR_LIVE) 212 await checkVideoState(liveVideoUUID, VideoState.WAITING_FOR_LIVE)
212 }) 213 })
213 214
@@ -219,7 +220,7 @@ describe('Save replay setting', function () {
219 220
220 await waitJobs(servers) 221 await waitJobs(servers)
221 222
222 await checkVideosExist(liveVideoUUID, true, 200) 223 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
223 await checkVideoState(liveVideoUUID, VideoState.PUBLISHED) 224 await checkVideoState(liveVideoUUID, VideoState.PUBLISHED)
224 }) 225 })
225 226
@@ -231,7 +232,7 @@ describe('Save replay setting', function () {
231 await waitJobs(servers) 232 await waitJobs(servers)
232 233
233 // Live has been transcoded 234 // Live has been transcoded
234 await checkVideosExist(liveVideoUUID, true, 200) 235 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
235 await checkVideoState(liveVideoUUID, VideoState.PUBLISHED) 236 await checkVideoState(liveVideoUUID, VideoState.PUBLISHED)
236 }) 237 })
237 238
@@ -261,7 +262,7 @@ describe('Save replay setting', function () {
261 await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoUUID) 262 await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoUUID)
262 263
263 await waitJobs(servers) 264 await waitJobs(servers)
264 await checkVideosExist(liveVideoUUID, true, 200) 265 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
265 266
266 await Promise.all([ 267 await Promise.all([
267 addVideoToBlacklist(servers[0].url, servers[0].accessToken, liveVideoUUID, 'bad live', true), 268 addVideoToBlacklist(servers[0].url, servers[0].accessToken, liveVideoUUID, 'bad live', true),
@@ -272,8 +273,8 @@ describe('Save replay setting', function () {
272 273
273 await checkVideosExist(liveVideoUUID, false) 274 await checkVideosExist(liveVideoUUID, false)
274 275
275 await getVideo(servers[0].url, liveVideoUUID, 401) 276 await getVideo(servers[0].url, liveVideoUUID, HttpStatusCode.UNAUTHORIZED_401)
276 await getVideo(servers[1].url, liveVideoUUID, 404) 277 await getVideo(servers[1].url, liveVideoUUID, HttpStatusCode.NOT_FOUND_404)
277 278
278 await checkLiveCleanup(servers[0], liveVideoUUID, [ 720 ]) 279 await checkLiveCleanup(servers[0], liveVideoUUID, [ 720 ])
279 }) 280 })
@@ -287,7 +288,7 @@ describe('Save replay setting', function () {
287 await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoUUID) 288 await waitUntilLiveStarts(servers[0].url, servers[0].accessToken, liveVideoUUID)
288 289
289 await waitJobs(servers) 290 await waitJobs(servers)
290 await checkVideosExist(liveVideoUUID, true, 200) 291 await checkVideosExist(liveVideoUUID, true, HttpStatusCode.OK_200)
291 292
292 await Promise.all([ 293 await Promise.all([
293 removeVideo(servers[0].url, servers[0].accessToken, liveVideoUUID), 294 removeVideo(servers[0].url, servers[0].accessToken, liveVideoUUID),
@@ -296,7 +297,7 @@ describe('Save replay setting', function () {
296 297
297 await waitJobs(servers) 298 await waitJobs(servers)
298 299
299 await checkVideosExist(liveVideoUUID, false, 404) 300 await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404)
300 await checkLiveCleanup(servers[0], liveVideoUUID, []) 301 await checkLiveCleanup(servers[0], liveVideoUUID, [])
301 }) 302 })
302 }) 303 })