aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/abuses.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 09:04:35 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit89d241a79c262b9775c233b73cff080043ebb5e6 (patch)
treecb3b6cb431d25d891ef4e02f66c61d252d17048f /server/tests/api/check-params/abuses.ts
parentd23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff)
downloadPeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip
Shorter server command names
Diffstat (limited to 'server/tests/api/check-params/abuses.ts')
-rw-r--r--server/tests/api/check-params/abuses.ts28
1 files changed, 14 insertions, 14 deletions
diff --git a/server/tests/api/check-params/abuses.ts b/server/tests/api/check-params/abuses.ts
index 199cc5599..7a6790ba8 100644
--- a/server/tests/api/check-params/abuses.ts
+++ b/server/tests/api/check-params/abuses.ts
@@ -39,12 +39,12 @@ describe('Test abuses API validators', function () {
39 39
40 await setAccessTokensToServers([ server ]) 40 await setAccessTokensToServers([ server ])
41 41
42 userToken = await server.usersCommand.generateUserAndToken('user_1') 42 userToken = await server.users.generateUserAndToken('user_1')
43 userToken2 = await server.usersCommand.generateUserAndToken('user_2') 43 userToken2 = await server.users.generateUserAndToken('user_2')
44 44
45 server.video = await server.videosCommand.upload() 45 server.store.video = await server.videos.upload()
46 46
47 command = server.abusesCommand 47 command = server.abuses
48 }) 48 })
49 49
50 describe('When listing abuses for admins', function () { 50 describe('When listing abuses for admins', function () {
@@ -224,25 +224,25 @@ describe('Test abuses API validators', function () {
224 }) 224 })
225 225
226 it('Should fail with a non authenticated user', async function () { 226 it('Should fail with a non authenticated user', async function () {
227 const fields = { video: { id: server.video.id }, reason: 'my super reason' } 227 const fields = { video: { id: server.store.video.id }, reason: 'my super reason' }
228 228
229 await makePostBodyRequest({ url: server.url, path, token: 'hello', fields, statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 }) 229 await makePostBodyRequest({ url: server.url, path, token: 'hello', fields, statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 })
230 }) 230 })
231 231
232 it('Should fail with a reason too short', async function () { 232 it('Should fail with a reason too short', async function () {
233 const fields = { video: { id: server.video.id }, reason: 'h' } 233 const fields = { video: { id: server.store.video.id }, reason: 'h' }
234 234
235 await makePostBodyRequest({ url: server.url, path, token: userToken, fields }) 235 await makePostBodyRequest({ url: server.url, path, token: userToken, fields })
236 }) 236 })
237 237
238 it('Should fail with a too big reason', async function () { 238 it('Should fail with a too big reason', async function () {
239 const fields = { video: { id: server.video.id }, reason: 'super'.repeat(605) } 239 const fields = { video: { id: server.store.video.id }, reason: 'super'.repeat(605) }
240 240
241 await makePostBodyRequest({ url: server.url, path, token: userToken, fields }) 241 await makePostBodyRequest({ url: server.url, path, token: userToken, fields })
242 }) 242 })
243 243
244 it('Should succeed with the correct parameters (basic)', async function () { 244 it('Should succeed with the correct parameters (basic)', async function () {
245 const fields: AbuseCreate = { video: { id: server.video.shortUUID }, reason: 'my super reason' } 245 const fields: AbuseCreate = { video: { id: server.store.video.shortUUID }, reason: 'my super reason' }
246 246
247 const res = await makePostBodyRequest({ 247 const res = await makePostBodyRequest({
248 url: server.url, 248 url: server.url,
@@ -255,19 +255,19 @@ describe('Test abuses API validators', function () {
255 }) 255 })
256 256
257 it('Should fail with a wrong predefined reason', async function () { 257 it('Should fail with a wrong predefined reason', async function () {
258 const fields = { video: { id: server.video.id }, reason: 'my super reason', predefinedReasons: [ 'wrongPredefinedReason' ] } 258 const fields = { video: { id: server.store.video.id }, reason: 'my super reason', predefinedReasons: [ 'wrongPredefinedReason' ] }
259 259
260 await makePostBodyRequest({ url: server.url, path, token: userToken, fields }) 260 await makePostBodyRequest({ url: server.url, path, token: userToken, fields })
261 }) 261 })
262 262
263 it('Should fail with negative timestamps', async function () { 263 it('Should fail with negative timestamps', async function () {
264 const fields = { video: { id: server.video.id, startAt: -1 }, reason: 'my super reason' } 264 const fields = { video: { id: server.store.video.id, startAt: -1 }, reason: 'my super reason' }
265 265
266 await makePostBodyRequest({ url: server.url, path, token: userToken, fields }) 266 await makePostBodyRequest({ url: server.url, path, token: userToken, fields })
267 }) 267 })
268 268
269 it('Should fail mith misordered startAt/endAt', async function () { 269 it('Should fail mith misordered startAt/endAt', async function () {
270 const fields = { video: { id: server.video.id, startAt: 5, endAt: 1 }, reason: 'my super reason' } 270 const fields = { video: { id: server.store.video.id, startAt: 5, endAt: 1 }, reason: 'my super reason' }
271 271
272 await makePostBodyRequest({ url: server.url, path, token: userToken, fields }) 272 await makePostBodyRequest({ url: server.url, path, token: userToken, fields })
273 }) 273 })
@@ -275,7 +275,7 @@ describe('Test abuses API validators', function () {
275 it('Should succeed with the corret parameters (advanced)', async function () { 275 it('Should succeed with the corret parameters (advanced)', async function () {
276 const fields: AbuseCreate = { 276 const fields: AbuseCreate = {
277 video: { 277 video: {
278 id: server.video.id, 278 id: server.store.video.id,
279 startAt: 1, 279 startAt: 1,
280 endAt: 5 280 endAt: 5
281 }, 281 },
@@ -414,8 +414,8 @@ describe('Test abuses API validators', function () {
414 414
415 await doubleFollow(anotherServer, server) 415 await doubleFollow(anotherServer, server)
416 416
417 const server2VideoId = await anotherServer.videosCommand.getId({ uuid: server.video.uuid }) 417 const server2VideoId = await anotherServer.videos.getId({ uuid: server.store.video.uuid })
418 await anotherServer.abusesCommand.report({ reason: 'remote server', videoId: server2VideoId }) 418 await anotherServer.abuses.report({ reason: 'remote server', videoId: server2VideoId })
419 419
420 await waitJobs([ server, anotherServer ]) 420 await waitJobs([ server, anotherServer ])
421 421