aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/video-comments.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params/video-comments.ts')
-rw-r--r--server/tests/api/check-params/video-comments.ts52
1 files changed, 26 insertions, 26 deletions
diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts
index 92c29da0e..bfd9e0172 100644
--- a/server/tests/api/check-params/video-comments.ts
+++ b/server/tests/api/check-params/video-comments.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/models'
6import { 6import {
7 checkBadCountPagination, 7 checkBadCountPagination,
8 checkBadSortPagination, 8 checkBadSortPagination,
@@ -78,7 +78,7 @@ describe('Test video comments API validator', function () {
78 await makeGetRequest({ 78 await makeGetRequest({
79 url: server.url, 79 url: server.url,
80 path: '/api/v1/videos/ba708d62-e3d7-45d9-9d73-41b9097cc02d/comment-threads', 80 path: '/api/v1/videos/ba708d62-e3d7-45d9-9d73-41b9097cc02d/comment-threads',
81 statusCodeExpected: HttpStatusCode.NOT_FOUND_404 81 expectedStatus: HttpStatusCode.NOT_FOUND_404
82 }) 82 })
83 }) 83 })
84 }) 84 })
@@ -88,7 +88,7 @@ describe('Test video comments API validator', function () {
88 await makeGetRequest({ 88 await makeGetRequest({
89 url: server.url, 89 url: server.url,
90 path: '/api/v1/videos/ba708d62-e3d7-45d9-9d73-41b9097cc02d/comment-threads/' + commentId, 90 path: '/api/v1/videos/ba708d62-e3d7-45d9-9d73-41b9097cc02d/comment-threads/' + commentId,
91 statusCodeExpected: HttpStatusCode.NOT_FOUND_404 91 expectedStatus: HttpStatusCode.NOT_FOUND_404
92 }) 92 })
93 }) 93 })
94 94
@@ -96,7 +96,7 @@ describe('Test video comments API validator', function () {
96 await makeGetRequest({ 96 await makeGetRequest({
97 url: server.url, 97 url: server.url,
98 path: '/api/v1/videos/' + video.shortUUID + '/comment-threads/156', 98 path: '/api/v1/videos/' + video.shortUUID + '/comment-threads/156',
99 statusCodeExpected: HttpStatusCode.NOT_FOUND_404 99 expectedStatus: HttpStatusCode.NOT_FOUND_404
100 }) 100 })
101 }) 101 })
102 102
@@ -104,7 +104,7 @@ describe('Test video comments API validator', function () {
104 await makeGetRequest({ 104 await makeGetRequest({
105 url: server.url, 105 url: server.url,
106 path: '/api/v1/videos/' + video.shortUUID + '/comment-threads/' + commentId, 106 path: '/api/v1/videos/' + video.shortUUID + '/comment-threads/' + commentId,
107 statusCodeExpected: HttpStatusCode.OK_200 107 expectedStatus: HttpStatusCode.OK_200
108 }) 108 })
109 }) 109 })
110 }) 110 })
@@ -120,7 +120,7 @@ describe('Test video comments API validator', function () {
120 path: pathThread, 120 path: pathThread,
121 token: 'none', 121 token: 'none',
122 fields, 122 fields,
123 statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 123 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
124 }) 124 })
125 }) 125 })
126 126
@@ -153,7 +153,7 @@ describe('Test video comments API validator', function () {
153 path, 153 path,
154 token: server.accessToken, 154 token: server.accessToken,
155 fields, 155 fields,
156 statusCodeExpected: HttpStatusCode.NOT_FOUND_404 156 expectedStatus: HttpStatusCode.NOT_FOUND_404
157 }) 157 })
158 }) 158 })
159 159
@@ -166,7 +166,7 @@ describe('Test video comments API validator', function () {
166 path: pathThread, 166 path: pathThread,
167 token: server.accessToken, 167 token: server.accessToken,
168 fields, 168 fields,
169 statusCodeExpected: HttpStatusCode.OK_200 169 expectedStatus: HttpStatusCode.OK_200
170 }) 170 })
171 }) 171 })
172 }) 172 })
@@ -181,7 +181,7 @@ describe('Test video comments API validator', function () {
181 path: pathComment, 181 path: pathComment,
182 token: 'none', 182 token: 'none',
183 fields, 183 fields,
184 statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 184 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
185 }) 185 })
186 }) 186 })
187 187
@@ -214,7 +214,7 @@ describe('Test video comments API validator', function () {
214 path, 214 path,
215 token: server.accessToken, 215 token: server.accessToken,
216 fields, 216 fields,
217 statusCodeExpected: HttpStatusCode.NOT_FOUND_404 217 expectedStatus: HttpStatusCode.NOT_FOUND_404
218 }) 218 })
219 }) 219 })
220 220
@@ -228,7 +228,7 @@ describe('Test video comments API validator', function () {
228 path, 228 path,
229 token: server.accessToken, 229 token: server.accessToken,
230 fields, 230 fields,
231 statusCodeExpected: HttpStatusCode.NOT_FOUND_404 231 expectedStatus: HttpStatusCode.NOT_FOUND_404
232 }) 232 })
233 }) 233 })
234 234
@@ -241,14 +241,14 @@ describe('Test video comments API validator', function () {
241 path: pathComment, 241 path: pathComment,
242 token: server.accessToken, 242 token: server.accessToken,
243 fields, 243 fields,
244 statusCodeExpected: HttpStatusCode.OK_200 244 expectedStatus: HttpStatusCode.OK_200
245 }) 245 })
246 }) 246 })
247 }) 247 })
248 248
249 describe('When removing video comments', function () { 249 describe('When removing video comments', function () {
250 it('Should fail with a non authenticated user', async function () { 250 it('Should fail with a non authenticated user', async function () {
251 await makeDeleteRequest({ url: server.url, path: pathComment, token: 'none', statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 }) 251 await makeDeleteRequest({ url: server.url, path: pathComment, token: 'none', expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
252 }) 252 })
253 253
254 it('Should fail with another user', async function () { 254 it('Should fail with another user', async function () {
@@ -256,18 +256,18 @@ describe('Test video comments API validator', function () {
256 url: server.url, 256 url: server.url,
257 path: pathComment, 257 path: pathComment,
258 token: userAccessToken, 258 token: userAccessToken,
259 statusCodeExpected: HttpStatusCode.FORBIDDEN_403 259 expectedStatus: HttpStatusCode.FORBIDDEN_403
260 }) 260 })
261 }) 261 })
262 262
263 it('Should fail with an incorrect video', async function () { 263 it('Should fail with an incorrect video', async function () {
264 const path = '/api/v1/videos/ba708d62-e3d7-45d9-9d73-41b9097cc02d/comments/' + commentId 264 const path = '/api/v1/videos/ba708d62-e3d7-45d9-9d73-41b9097cc02d/comments/' + commentId
265 await makeDeleteRequest({ url: server.url, path, token: server.accessToken, statusCodeExpected: HttpStatusCode.NOT_FOUND_404 }) 265 await makeDeleteRequest({ url: server.url, path, token: server.accessToken, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
266 }) 266 })
267 267
268 it('Should fail with an incorrect comment', async function () { 268 it('Should fail with an incorrect comment', async function () {
269 const path = '/api/v1/videos/' + video.uuid + '/comments/124' 269 const path = '/api/v1/videos/' + video.uuid + '/comments/124'
270 await makeDeleteRequest({ url: server.url, path, token: server.accessToken, statusCodeExpected: HttpStatusCode.NOT_FOUND_404 }) 270 await makeDeleteRequest({ url: server.url, path, token: server.accessToken, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
271 }) 271 })
272 272
273 it('Should succeed with the same user', async function () { 273 it('Should succeed with the same user', async function () {
@@ -280,8 +280,8 @@ describe('Test video comments API validator', function () {
280 280
281 const path = '/api/v1/videos/' + video.uuid + '/comments/' + commentToDelete 281 const path = '/api/v1/videos/' + video.uuid + '/comments/' + commentToDelete
282 282
283 await makeDeleteRequest({ url: server.url, path, token: userAccessToken2, statusCodeExpected: HttpStatusCode.FORBIDDEN_403 }) 283 await makeDeleteRequest({ url: server.url, path, token: userAccessToken2, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
284 await makeDeleteRequest({ url: server.url, path, token: userAccessToken, statusCodeExpected: HttpStatusCode.NO_CONTENT_204 }) 284 await makeDeleteRequest({ url: server.url, path, token: userAccessToken, expectedStatus: HttpStatusCode.NO_CONTENT_204 })
285 }) 285 })
286 286
287 it('Should succeed with the owner of the video', async function () { 287 it('Should succeed with the owner of the video', async function () {
@@ -300,8 +300,8 @@ describe('Test video comments API validator', function () {
300 300
301 const path = '/api/v1/videos/' + anotherVideoUUID + '/comments/' + commentToDelete 301 const path = '/api/v1/videos/' + anotherVideoUUID + '/comments/' + commentToDelete
302 302
303 await makeDeleteRequest({ url: server.url, path, token: userAccessToken2, statusCodeExpected: HttpStatusCode.FORBIDDEN_403 }) 303 await makeDeleteRequest({ url: server.url, path, token: userAccessToken2, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
304 await makeDeleteRequest({ url: server.url, path, token: userAccessToken, statusCodeExpected: HttpStatusCode.NO_CONTENT_204 }) 304 await makeDeleteRequest({ url: server.url, path, token: userAccessToken, expectedStatus: HttpStatusCode.NO_CONTENT_204 })
305 }) 305 })
306 306
307 it('Should succeed with the correct parameters', async function () { 307 it('Should succeed with the correct parameters', async function () {
@@ -309,7 +309,7 @@ describe('Test video comments API validator', function () {
309 url: server.url, 309 url: server.url,
310 path: pathComment, 310 path: pathComment,
311 token: server.accessToken, 311 token: server.accessToken,
312 statusCodeExpected: HttpStatusCode.NO_CONTENT_204 312 expectedStatus: HttpStatusCode.NO_CONTENT_204
313 }) 313 })
314 }) 314 })
315 }) 315 })
@@ -324,7 +324,7 @@ describe('Test video comments API validator', function () {
324 const res = await makeGetRequest({ 324 const res = await makeGetRequest({
325 url: server.url, 325 url: server.url,
326 path: pathThread, 326 path: pathThread,
327 statusCodeExpected: HttpStatusCode.OK_200 327 expectedStatus: HttpStatusCode.OK_200
328 }) 328 })
329 expect(res.body.total).to.equal(0) 329 expect(res.body.total).to.equal(0)
330 expect(res.body.data).to.have.lengthOf(0) 330 expect(res.body.data).to.have.lengthOf(0)
@@ -341,7 +341,7 @@ describe('Test video comments API validator', function () {
341 path: pathThread, 341 path: pathThread,
342 token: server.accessToken, 342 token: server.accessToken,
343 fields, 343 fields,
344 statusCodeExpected: HttpStatusCode.CONFLICT_409 344 expectedStatus: HttpStatusCode.CONFLICT_409
345 }) 345 })
346 }) 346 })
347 347
@@ -367,7 +367,7 @@ describe('Test video comments API validator', function () {
367 await makeGetRequest({ 367 await makeGetRequest({
368 url: server.url, 368 url: server.url,
369 path, 369 path,
370 statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 370 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
371 }) 371 })
372 }) 372 })
373 373
@@ -376,7 +376,7 @@ describe('Test video comments API validator', function () {
376 url: server.url, 376 url: server.url,
377 path, 377 path,
378 token: userAccessToken, 378 token: userAccessToken,
379 statusCodeExpected: HttpStatusCode.FORBIDDEN_403 379 expectedStatus: HttpStatusCode.FORBIDDEN_403
380 }) 380 })
381 }) 381 })
382 382
@@ -391,7 +391,7 @@ describe('Test video comments API validator', function () {
391 searchAccount: 'toto', 391 searchAccount: 'toto',
392 searchVideo: 'toto' 392 searchVideo: 'toto'
393 }, 393 },
394 statusCodeExpected: HttpStatusCode.OK_200 394 expectedStatus: HttpStatusCode.OK_200
395 }) 395 })
396 }) 396 })
397 }) 397 })