From c3d29f694bf8c910f917be655626d0f80871124f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 7 Jul 2021 09:16:40 +0200 Subject: Introduce follows command --- server/tests/api/users/user-subscriptions.ts | 33 +++++++++++++--------------- server/tests/api/users/users.ts | 8 +++++-- 2 files changed, 21 insertions(+), 20 deletions(-) (limited to 'server/tests/api/users') diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts index 60676a37b..7e365d797 100644 --- a/server/tests/api/users/user-subscriptions.ts +++ b/server/tests/api/users/user-subscriptions.ts @@ -1,30 +1,27 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' import 'mocha' +import * as chai from 'chai' import { + addUserSubscription, + areSubscriptionsExist, cleanupTests, createUser, doubleFollow, flushAndRunMultipleServers, - follow, - getVideosList, - unfollow, - updateVideo, - userLogin -} from '../../../../shared/extra-utils' -import { ServerInfo, uploadVideo } from '../../../../shared/extra-utils/index' -import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login' -import { Video, VideoChannel } from '../../../../shared/models/videos' -import { waitJobs } from '../../../../shared/extra-utils/server/jobs' -import { - addUserSubscription, - areSubscriptionsExist, getUserSubscription, + getVideosList, listUserSubscriptions, listUserSubscriptionVideos, - removeUserSubscription -} from '../../../../shared/extra-utils/users/user-subscriptions' + removeUserSubscription, + ServerInfo, + setAccessTokensToServers, + updateVideo, + uploadVideo, + userLogin, + waitJobs +} from '@shared/extra-utils' +import { Video, VideoChannel } from '@shared/models' const expect = chai.expect @@ -250,7 +247,7 @@ describe('Test users subscriptions', function () { it('Should have server 1 follow server 3 and display server 3 videos', async function () { this.timeout(60000) - await follow(servers[0].url, [ servers[2].url ], servers[0].accessToken) + await servers[0].followsCommand.follow({ targets: [ servers[2].url ] }) await waitJobs(servers) @@ -268,7 +265,7 @@ describe('Test users subscriptions', function () { it('Should remove follow server 1 -> server 3 and hide server 3 videos', async function () { this.timeout(60000) - await unfollow(servers[0].url, servers[0].accessToken, servers[2]) + await servers[0].followsCommand.unfollow({ target: servers[2] }) await waitJobs(servers) diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index 6bfc7cfe5..92927ea97 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts @@ -11,7 +11,6 @@ import { createUser, deleteMe, flushAndRunServer, - follow, getAccountRatings, getBlacklistedVideosList, getCustomConfig, @@ -138,7 +137,12 @@ describe('Test users', function () { it('Should not be able to follow', async function () { accessToken = 'my_super_token' - await follow(server.url, [ 'http://example.com' ], accessToken, HttpStatusCode.UNAUTHORIZED_401) + + await server.followsCommand.follow({ + targets: [ 'http://example.com' ], + token: accessToken, + expectedStatus: HttpStatusCode.UNAUTHORIZED_401 + }) }) it('Should not be able to unfollow') -- cgit v1.2.3