From 5f8bd4cbb178290da7d8f81e996f19f0eccc8e4c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 7 Jul 2021 16:02:46 +0200 Subject: Introduce blocklist command --- server/tests/api/videos/video-playlists.ts | 26 ++++++++++---------------- server/tests/api/videos/videos-overview.ts | 3 +-- 2 files changed, 11 insertions(+), 18 deletions(-) (limited to 'server/tests/api/videos') 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' import * as chai from 'chai' import { HttpStatusCode } from '@shared/core-utils' import { - addAccountToAccountBlocklist, - addAccountToServerBlocklist, - addServerToAccountBlocklist, - addServerToServerBlocklist, addVideoChannel, addVideoInPlaylist, addVideoToBlacklist, @@ -31,10 +27,6 @@ import { getVideoPlaylistPrivacies, getVideoPlaylistsList, getVideoPlaylistWithToken, - removeAccountFromAccountBlocklist, - removeAccountFromServerBlocklist, - removeServerFromAccountBlocklist, - removeServerFromServerBlocklist, removeUser, removeVideoFromBlacklist, removeVideoFromPlaylist, @@ -760,56 +752,58 @@ describe('Test video playlists', function () { it('Should update the element type if the account or server of the video is blocked', async function () { this.timeout(90000) + const command = servers[0].blocklistCommand + const name = 'video 90' const position = 2 { - await addAccountToAccountBlocklist(servers[0].url, userAccessTokenServer1, 'root@localhost:' + servers[1].port) + await command.addToMyBlocklist({ token: userAccessTokenServer1, account: 'root@localhost:' + servers[1].port }) await waitJobs(servers) await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) - await removeAccountFromAccountBlocklist(servers[0].url, userAccessTokenServer1, 'root@localhost:' + servers[1].port) + await command.removeFromMyBlocklist({ token: userAccessTokenServer1, account: 'root@localhost:' + servers[1].port }) await waitJobs(servers) await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) } { - await addServerToAccountBlocklist(servers[0].url, userAccessTokenServer1, 'localhost:' + servers[1].port) + await command.addToMyBlocklist({ token: userAccessTokenServer1, server: 'localhost:' + servers[1].port }) await waitJobs(servers) await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) - await removeServerFromAccountBlocklist(servers[0].url, userAccessTokenServer1, 'localhost:' + servers[1].port) + await command.removeFromMyBlocklist({ token: userAccessTokenServer1, server: 'localhost:' + servers[1].port }) await waitJobs(servers) await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) } { - await addAccountToServerBlocklist(servers[0].url, servers[0].accessToken, 'root@localhost:' + servers[1].port) + await command.addToServerBlocklist({ account: 'root@localhost:' + servers[1].port }) await waitJobs(servers) await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) - await removeAccountFromServerBlocklist(servers[0].url, servers[0].accessToken, 'root@localhost:' + servers[1].port) + await command.removeFromServerBlocklist({ account: 'root@localhost:' + servers[1].port }) await waitJobs(servers) await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) } { - await addServerToServerBlocklist(servers[0].url, servers[0].accessToken, 'localhost:' + servers[1].port) + await command.addToServerBlocklist({ server: 'localhost:' + servers[1].port }) await waitJobs(servers) await checkPlaylistElementType(groupUser1, playlistServer1UUID2, VideoPlaylistElementType.UNAVAILABLE, position, name, 3) await checkPlaylistElementType(group2, playlistServer1UUID2, VideoPlaylistElementType.REGULAR, position, name, 3) - await removeServerFromServerBlocklist(servers[0].url, servers[0].accessToken, 'localhost:' + servers[1].port) + await command.removeFromServerBlocklist({ server: 'localhost:' + servers[1].port }) await waitJobs(servers) 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 @@ import 'mocha' import * as chai from 'chai' import { - addAccountToAccountBlocklist, cleanupTests, flushAndRunServer, generateUserAccessToken, @@ -115,7 +114,7 @@ describe('Test a videos overview', function () { it('Should hide muted accounts', async function () { const token = await generateUserAccessToken(server, 'choco') - await addAccountToAccountBlocklist(server.url, token, 'root@' + server.host) + await server.blocklistCommand.addToMyBlocklist({ token, account: 'root@' + server.host }) { const body = await server.overviewsCommand.getVideos({ page: 1 }) -- cgit v1.2.3