aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-07 16:02:46 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:17 +0200
commit5f8bd4cbb178290da7d8f81e996f19f0eccc8e4c (patch)
tree02d056121540652b0867fc2ef56699138afe6271 /server/tests/api/videos
parent9fff08cf83f34339df7ed4ac770e1dee536adf9d (diff)
downloadPeerTube-5f8bd4cbb178290da7d8f81e996f19f0eccc8e4c.tar.gz
PeerTube-5f8bd4cbb178290da7d8f81e996f19f0eccc8e4c.tar.zst
PeerTube-5f8bd4cbb178290da7d8f81e996f19f0eccc8e4c.zip
Introduce blocklist command
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r--server/tests/api/videos/video-playlists.ts26
-rw-r--r--server/tests/api/videos/videos-overview.ts3
2 files changed, 11 insertions, 18 deletions
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts
index 28f68dcfe..90189721a 100644
--- a/server/tests/api/videos/video-playlists.ts
+++ b/server/tests/api/videos/video-playlists.ts
@@ -4,10 +4,6 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 addAccountToAccountBlocklist,
8 addAccountToServerBlocklist,
9 addServerToAccountBlocklist,
10 addServerToServerBlocklist,
11 addVideoChannel, 7 addVideoChannel,
12 addVideoInPlaylist, 8 addVideoInPlaylist,
13 addVideoToBlacklist, 9 addVideoToBlacklist,
@@ -31,10 +27,6 @@ import {
31 getVideoPlaylistPrivacies, 27 getVideoPlaylistPrivacies,
32 getVideoPlaylistsList, 28 getVideoPlaylistsList,
33 getVideoPlaylistWithToken, 29 getVideoPlaylistWithToken,
34 removeAccountFromAccountBlocklist,
35 removeAccountFromServerBlocklist,
36 removeServerFromAccountBlocklist,
37 removeServerFromServerBlocklist,
38 removeUser, 30 removeUser,
39 removeVideoFromBlacklist, 31 removeVideoFromBlacklist,
40 removeVideoFromPlaylist, 32 removeVideoFromPlaylist,
@@ -760,56 +752,58 @@ describe('Test video playlists', function () {
760 it('Should update the element type if the account or server of the video is blocked', async function () { 752 it('Should update the element type if the account or server of the video is blocked', async function () {
761 this.timeout(90000) 753 this.timeout(90000)
762 754
755 const command = servers[0].blocklistCommand
756
763 const name = 'video 90' 757 const name = 'video 90'
764 const position = 2 758 const position = 2
765 759
766 { 760 {
767 await addAccountToAccountBlocklist(servers[0].url, userAccessTokenServer1, 'root@localhost:' + servers[1].port) 761 await command.addToMyBlocklist({ token: userAccessTokenServer1, account: 'root@localhost:' + servers[1].port })
768 await waitJobs(servers) 762 await waitJobs(servers)
769 763
770 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) 764 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)
771 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 765 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
772 766
773 await removeAccountFromAccountBlocklist(servers[0].url, userAccessTokenServer1, 'root@localhost:' + servers[1].port) 767 await command.removeFromMyBlocklist({ token: userAccessTokenServer1, account: 'root@localhost:' + servers[1].port })
774 await waitJobs(servers) 768 await waitJobs(servers)
775 769
776 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 770 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
777 } 771 }
778 772
779 { 773 {
780 await addServerToAccountBlocklist(servers[0].url, userAccessTokenServer1, 'localhost:' + servers[1].port) 774 await command.addToMyBlocklist({ token: userAccessTokenServer1, server: 'localhost:' + servers[1].port })
781 await waitJobs(servers) 775 await waitJobs(servers)
782 776
783 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) 777 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)
784 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 778 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
785 779
786 await removeServerFromAccountBlocklist(servers[0].url, userAccessTokenServer1, 'localhost:' + servers[1].port) 780 await command.removeFromMyBlocklist({ token: userAccessTokenServer1, server: 'localhost:' + servers[1].port })
787 await waitJobs(servers) 781 await waitJobs(servers)
788 782
789 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 783 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
790 } 784 }
791 785
792 { 786 {
793 await addAccountToServerBlocklist(servers[0].url, servers[0].accessToken, 'root@localhost:' + servers[1].port) 787 await command.addToServerBlocklist({ account: 'root@localhost:' + servers[1].port })
794 await waitJobs(servers) 788 await waitJobs(servers)
795 789
796 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) 790 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)
797 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 791 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
798 792
799 await removeAccountFromServerBlocklist(servers[0].url, servers[0].accessToken, 'root@localhost:' + servers[1].port) 793 await command.removeFromServerBlocklist({ account: 'root@localhost:' + servers[1].port })
800 await waitJobs(servers) 794 await waitJobs(servers)
801 795
802 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 796 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
803 } 797 }
804 798
805 { 799 {
806 await addServerToServerBlocklist(servers[0].url, servers[0].accessToken, 'localhost:' + servers[1].port) 800 await command.addToServerBlocklist({ server: 'localhost:' + servers[1].port })
807 await waitJobs(servers) 801 await waitJobs(servers)
808 802
809 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) 803 await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3)
810 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 804 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
811 805
812 await removeServerFromServerBlocklist(servers[0].url, servers[0].accessToken, 'localhost:' + servers[1].port) 806 await command.removeFromServerBlocklist({ server: 'localhost:' + servers[1].port })
813 await waitJobs(servers) 807 await waitJobs(servers)
814 808
815 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) 809 await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3)
diff --git a/server/tests/api/videos/videos-overview.ts b/server/tests/api/videos/videos-overview.ts
index b3ab9e070..ccbc6f4a4 100644
--- a/server/tests/api/videos/videos-overview.ts
+++ b/server/tests/api/videos/videos-overview.ts
@@ -3,7 +3,6 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { 5import {
6 addAccountToAccountBlocklist,
7 cleanupTests, 6 cleanupTests,
8 flushAndRunServer, 7 flushAndRunServer,
9 generateUserAccessToken, 8 generateUserAccessToken,
@@ -115,7 +114,7 @@ describe('Test a videos overview', function () {
115 it('Should hide muted accounts', async function () { 114 it('Should hide muted accounts', async function () {
116 const token = await generateUserAccessToken(server, 'choco') 115 const token = await generateUserAccessToken(server, 'choco')
117 116
118 await addAccountToAccountBlocklist(server.url, token, 'root@' + server.host) 117 await server.blocklistCommand.addToMyBlocklist({ token, account: 'root@' + server.host })
119 118
120 { 119 {
121 const body = await server.overviewsCommand.getVideos({ page: 1 }) 120 const body = await server.overviewsCommand.getVideos({ page: 1 })