aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-22 09:03:45 +0100
committerChocobozzz <me@florianbigard.com>2018-02-22 09:03:45 +0100
commit6221f311de0eb8f2a9e7e4a77b8cb0ecbde6dfcd (patch)
tree895e833221877e5f2c4bf291a7cd1bda05cf8865 /server/tests/api/check-params
parent9f4183c9b57acd382668d49e86b0001bcd55550f (diff)
downloadPeerTube-6221f311de0eb8f2a9e7e4a77b8cb0ecbde6dfcd.tar.gz
PeerTube-6221f311de0eb8f2a9e7e4a77b8cb0ecbde6dfcd.tar.zst
PeerTube-6221f311de0eb8f2a9e7e4a77b8cb0ecbde6dfcd.zip
Add ability to update another user video
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r--server/tests/api/check-params/videos.ts28
1 files changed, 22 insertions, 6 deletions
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index 1d5c8543d..1d19daa60 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -16,7 +16,9 @@ const expect = chai.expect
16describe('Test videos API validator', function () { 16describe('Test videos API validator', function () {
17 const path = '/api/v1/videos/' 17 const path = '/api/v1/videos/'
18 let server: ServerInfo 18 let server: ServerInfo
19 let userAccessToken = ''
19 let channelId: number 20 let channelId: number
21 let videoId
20 22
21 // --------------------------------------------------------------- 23 // ---------------------------------------------------------------
22 24
@@ -29,6 +31,11 @@ describe('Test videos API validator', function () {
29 31
30 await setAccessTokensToServers([ server ]) 32 await setAccessTokensToServers([ server ])
31 33
34 const username = 'user1'
35 const password = 'my super password'
36 await createUser(server.url, server.accessToken, username, password)
37 userAccessToken = await userLogin(server, { username, password })
38
32 const res = await getMyUserInformation(server.url, server.accessToken) 39 const res = await getMyUserInformation(server.url, server.accessToken)
33 channelId = res.body.videoChannels[0].id 40 channelId = res.body.videoChannels[0].id
34 }) 41 })
@@ -359,11 +366,10 @@ describe('Test videos API validator', function () {
359 privacy: VideoPrivacy.PUBLIC, 366 privacy: VideoPrivacy.PUBLIC,
360 tags: [ 'tag1', 'tag2' ] 367 tags: [ 'tag1', 'tag2' ]
361 } 368 }
362 let videoId
363 369
364 before(async function () { 370 before(async function () {
365 const res = await getVideosList(server.url) 371 const res = await getVideosList(server.url)
366 videoId = res.body.data[0].id 372 videoId = res.body.data[0].uuid
367 }) 373 })
368 374
369 it('Should fail with nothing', async function () { 375 it('Should fail with nothing', async function () {
@@ -518,7 +524,11 @@ describe('Test videos API validator', function () {
518 }) 524 })
519 }) 525 })
520 526
521 it('Should fail with a video of another user') 527 it('Should fail with a video of another user without the appropriate right', async function () {
528 const fields = baseCorrectParams
529
530 await makePutBodyRequest({ url: server.url, path: path + videoId, token: userAccessToken, fields, statusCodeExpected: 403 })
531 })
522 532
523 it('Should fail with a video of another server') 533 it('Should fail with a video of another server')
524 534
@@ -549,7 +559,9 @@ describe('Test videos API validator', function () {
549 await getVideo(server.url, '4da6fde3-88f7-4d16-b119-108df5630b06', 404) 559 await getVideo(server.url, '4da6fde3-88f7-4d16-b119-108df5630b06', 404)
550 }) 560 })
551 561
552 it('Should succeed with the correct parameters') 562 it('Should succeed with the correct parameters', async function () {
563 await getVideo(server.url, videoId)
564 })
553 }) 565 })
554 566
555 describe('When rating a video', function () { 567 describe('When rating a video', function () {
@@ -618,11 +630,15 @@ describe('Test videos API validator', function () {
618 await removeVideo(server.url, server.accessToken, '4da6fde3-88f7-4d16-b119-108df5630b06', 404) 630 await removeVideo(server.url, server.accessToken, '4da6fde3-88f7-4d16-b119-108df5630b06', 404)
619 }) 631 })
620 632
621 it('Should fail with a video of another user') 633 it('Should fail with a video of another user without the appropriate right', async function () {
634 await removeVideo(server.url, userAccessToken, videoId, 403)
635 })
622 636
623 it('Should fail with a video of another server') 637 it('Should fail with a video of another server')
624 638
625 it('Should succeed with the correct parameters') 639 it('Should succeed with the correct parameters', async function () {
640 await removeVideo(server.url, server.accessToken, videoId)
641 })
626 }) 642 })
627 643
628 after(async function () { 644 after(async function () {