diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-16 09:04:35 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | 89d241a79c262b9775c233b73cff080043ebb5e6 (patch) | |
tree | cb3b6cb431d25d891ef4e02f66c61d252d17048f /server/tests/api/check-params/videos.ts | |
parent | d23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff) | |
download | PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip |
Shorter server command names
Diffstat (limited to 'server/tests/api/check-params/videos.ts')
-rw-r--r-- | server/tests/api/check-params/videos.ts | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index 8f9f33b8c..69bdae7cf 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts | |||
@@ -44,11 +44,11 @@ describe('Test videos API validator', function () { | |||
44 | 44 | ||
45 | const username = 'user1' | 45 | const username = 'user1' |
46 | const password = 'my super password' | 46 | const password = 'my super password' |
47 | await server.usersCommand.create({ username: username, password: password }) | 47 | await server.users.create({ username: username, password: password }) |
48 | userAccessToken = await server.loginCommand.getAccessToken({ username, password }) | 48 | userAccessToken = await server.login.getAccessToken({ username, password }) |
49 | 49 | ||
50 | { | 50 | { |
51 | const body = await server.usersCommand.getMyInfo() | 51 | const body = await server.users.getMyInfo() |
52 | channelId = body.videoChannels[0].id | 52 | channelId = body.videoChannels[0].id |
53 | channelName = body.videoChannels[0].name | 53 | channelName = body.videoChannels[0].name |
54 | accountName = body.account.name + '@' + body.account.host | 54 | accountName = body.account.name + '@' + body.account.host |
@@ -274,10 +274,10 @@ describe('Test videos API validator', function () { | |||
274 | username: 'fake' + randomInt(0, 1500), | 274 | username: 'fake' + randomInt(0, 1500), |
275 | password: 'fake_password' | 275 | password: 'fake_password' |
276 | } | 276 | } |
277 | await server.usersCommand.create({ username: user.username, password: user.password }) | 277 | await server.users.create({ username: user.username, password: user.password }) |
278 | 278 | ||
279 | const accessTokenUser = await server.loginCommand.getAccessToken(user) | 279 | const accessTokenUser = await server.login.getAccessToken(user) |
280 | const { videoChannels } = await server.usersCommand.getMyInfo({ token: accessTokenUser }) | 280 | const { videoChannels } = await server.users.getMyInfo({ token: accessTokenUser }) |
281 | const customChannelId = videoChannels[0].id | 281 | const customChannelId = videoChannels[0].id |
282 | 282 | ||
283 | const fields = { ...baseCorrectParams, channelId: customChannelId } | 283 | const fields = { ...baseCorrectParams, channelId: customChannelId } |
@@ -484,7 +484,7 @@ describe('Test videos API validator', function () { | |||
484 | } | 484 | } |
485 | 485 | ||
486 | before(async function () { | 486 | before(async function () { |
487 | const { data } = await server.videosCommand.list() | 487 | const { data } = await server.videos.list() |
488 | video = data[0] | 488 | video = data[0] |
489 | }) | 489 | }) |
490 | 490 | ||
@@ -710,15 +710,15 @@ describe('Test videos API validator', function () { | |||
710 | }) | 710 | }) |
711 | 711 | ||
712 | it('Should fail without a correct uuid', async function () { | 712 | it('Should fail without a correct uuid', async function () { |
713 | await server.videosCommand.get({ id: 'coucou', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 713 | await server.videos.get({ id: 'coucou', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
714 | }) | 714 | }) |
715 | 715 | ||
716 | it('Should return 404 with an incorrect video', async function () { | 716 | it('Should return 404 with an incorrect video', async function () { |
717 | await server.videosCommand.get({ id: '4da6fde3-88f7-4d16-b119-108df5630b06', expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | 717 | await server.videos.get({ id: '4da6fde3-88f7-4d16-b119-108df5630b06', expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
718 | }) | 718 | }) |
719 | 719 | ||
720 | it('Shoud report the appropriate error', async function () { | 720 | it('Shoud report the appropriate error', async function () { |
721 | const body = await server.videosCommand.get({ id: 'hi', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 721 | const body = await server.videos.get({ id: 'hi', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
722 | const error = body as unknown as PeerTubeProblemDocument | 722 | const error = body as unknown as PeerTubeProblemDocument |
723 | 723 | ||
724 | expect(error.docs).to.equal('https://docs.joinpeertube.org/api-rest-reference.html#operation/getVideo') | 724 | expect(error.docs).to.equal('https://docs.joinpeertube.org/api-rest-reference.html#operation/getVideo') |
@@ -734,7 +734,7 @@ describe('Test videos API validator', function () { | |||
734 | }) | 734 | }) |
735 | 735 | ||
736 | it('Should succeed with the correct parameters', async function () { | 736 | it('Should succeed with the correct parameters', async function () { |
737 | await server.videosCommand.get({ id: video.shortUUID }) | 737 | await server.videos.get({ id: video.shortUUID }) |
738 | }) | 738 | }) |
739 | }) | 739 | }) |
740 | 740 | ||
@@ -742,7 +742,7 @@ describe('Test videos API validator', function () { | |||
742 | let videoId: number | 742 | let videoId: number |
743 | 743 | ||
744 | before(async function () { | 744 | before(async function () { |
745 | const { data } = await server.videosCommand.list() | 745 | const { data } = await server.videos.list() |
746 | videoId = data[0].id | 746 | videoId = data[0].id |
747 | }) | 747 | }) |
748 | 748 | ||
@@ -797,21 +797,21 @@ describe('Test videos API validator', function () { | |||
797 | }) | 797 | }) |
798 | 798 | ||
799 | it('Should fail without a correct uuid', async function () { | 799 | it('Should fail without a correct uuid', async function () { |
800 | await server.videosCommand.remove({ id: 'hello', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 800 | await server.videos.remove({ id: 'hello', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
801 | }) | 801 | }) |
802 | 802 | ||
803 | it('Should fail with a video which does not exist', async function () { | 803 | it('Should fail with a video which does not exist', async function () { |
804 | await server.videosCommand.remove({ id: '4da6fde3-88f7-4d16-b119-108df5630b06', expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | 804 | await server.videos.remove({ id: '4da6fde3-88f7-4d16-b119-108df5630b06', expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
805 | }) | 805 | }) |
806 | 806 | ||
807 | it('Should fail with a video of another user without the appropriate right', async function () { | 807 | it('Should fail with a video of another user without the appropriate right', async function () { |
808 | await server.videosCommand.remove({ token: userAccessToken, id: video.uuid, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | 808 | await server.videos.remove({ token: userAccessToken, id: video.uuid, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
809 | }) | 809 | }) |
810 | 810 | ||
811 | it('Should fail with a video of another server') | 811 | it('Should fail with a video of another server') |
812 | 812 | ||
813 | it('Shoud report the appropriate error', async function () { | 813 | it('Shoud report the appropriate error', async function () { |
814 | const body = await server.videosCommand.remove({ id: 'hello', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 814 | const body = await server.videos.remove({ id: 'hello', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
815 | const error = body as unknown as PeerTubeProblemDocument | 815 | const error = body as unknown as PeerTubeProblemDocument |
816 | 816 | ||
817 | expect(error.docs).to.equal('https://docs.joinpeertube.org/api-rest-reference.html#operation/delVideo') | 817 | expect(error.docs).to.equal('https://docs.joinpeertube.org/api-rest-reference.html#operation/delVideo') |
@@ -827,7 +827,7 @@ describe('Test videos API validator', function () { | |||
827 | }) | 827 | }) |
828 | 828 | ||
829 | it('Should succeed with the correct parameters', async function () { | 829 | it('Should succeed with the correct parameters', async function () { |
830 | await server.videosCommand.remove({ id: video.uuid }) | 830 | await server.videos.remove({ id: video.uuid }) |
831 | }) | 831 | }) |
832 | }) | 832 | }) |
833 | 833 | ||