diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-07 09:16:40 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:17 +0200 |
commit | c3d29f694bf8c910f917be655626d0f80871124f (patch) | |
tree | c90dfdc1245c8a9aca49e9ea9c71ed8e6b9dd35f /server/tests/api/users | |
parent | 883a9019085ff9013079d6b1539b86f2f519175a (diff) | |
download | PeerTube-c3d29f694bf8c910f917be655626d0f80871124f.tar.gz PeerTube-c3d29f694bf8c910f917be655626d0f80871124f.tar.zst PeerTube-c3d29f694bf8c910f917be655626d0f80871124f.zip |
Introduce follows command
Diffstat (limited to 'server/tests/api/users')
-rw-r--r-- | server/tests/api/users/user-subscriptions.ts | 33 | ||||
-rw-r--r-- | server/tests/api/users/users.ts | 8 |
2 files changed, 21 insertions, 20 deletions
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 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import * as chai from 'chai' | ||
4 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | ||
5 | import { | 5 | import { |
6 | addUserSubscription, | ||
7 | areSubscriptionsExist, | ||
6 | cleanupTests, | 8 | cleanupTests, |
7 | createUser, | 9 | createUser, |
8 | doubleFollow, | 10 | doubleFollow, |
9 | flushAndRunMultipleServers, | 11 | flushAndRunMultipleServers, |
10 | follow, | ||
11 | getVideosList, | ||
12 | unfollow, | ||
13 | updateVideo, | ||
14 | userLogin | ||
15 | } from '../../../../shared/extra-utils' | ||
16 | import { ServerInfo, uploadVideo } from '../../../../shared/extra-utils/index' | ||
17 | import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/login' | ||
18 | import { Video, VideoChannel } from '../../../../shared/models/videos' | ||
19 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' | ||
20 | import { | ||
21 | addUserSubscription, | ||
22 | areSubscriptionsExist, | ||
23 | getUserSubscription, | 12 | getUserSubscription, |
13 | getVideosList, | ||
24 | listUserSubscriptions, | 14 | listUserSubscriptions, |
25 | listUserSubscriptionVideos, | 15 | listUserSubscriptionVideos, |
26 | removeUserSubscription | 16 | removeUserSubscription, |
27 | } from '../../../../shared/extra-utils/users/user-subscriptions' | 17 | ServerInfo, |
18 | setAccessTokensToServers, | ||
19 | updateVideo, | ||
20 | uploadVideo, | ||
21 | userLogin, | ||
22 | waitJobs | ||
23 | } from '@shared/extra-utils' | ||
24 | import { Video, VideoChannel } from '@shared/models' | ||
28 | 25 | ||
29 | const expect = chai.expect | 26 | const expect = chai.expect |
30 | 27 | ||
@@ -250,7 +247,7 @@ describe('Test users subscriptions', function () { | |||
250 | it('Should have server 1 follow server 3 and display server 3 videos', async function () { | 247 | it('Should have server 1 follow server 3 and display server 3 videos', async function () { |
251 | this.timeout(60000) | 248 | this.timeout(60000) |
252 | 249 | ||
253 | await follow(servers[0].url, [ servers[2].url ], servers[0].accessToken) | 250 | await servers[0].followsCommand.follow({ targets: [ servers[2].url ] }) |
254 | 251 | ||
255 | await waitJobs(servers) | 252 | await waitJobs(servers) |
256 | 253 | ||
@@ -268,7 +265,7 @@ describe('Test users subscriptions', function () { | |||
268 | it('Should remove follow server 1 -> server 3 and hide server 3 videos', async function () { | 265 | it('Should remove follow server 1 -> server 3 and hide server 3 videos', async function () { |
269 | this.timeout(60000) | 266 | this.timeout(60000) |
270 | 267 | ||
271 | await unfollow(servers[0].url, servers[0].accessToken, servers[2]) | 268 | await servers[0].followsCommand.unfollow({ target: servers[2] }) |
272 | 269 | ||
273 | await waitJobs(servers) | 270 | await waitJobs(servers) |
274 | 271 | ||
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 { | |||
11 | createUser, | 11 | createUser, |
12 | deleteMe, | 12 | deleteMe, |
13 | flushAndRunServer, | 13 | flushAndRunServer, |
14 | follow, | ||
15 | getAccountRatings, | 14 | getAccountRatings, |
16 | getBlacklistedVideosList, | 15 | getBlacklistedVideosList, |
17 | getCustomConfig, | 16 | getCustomConfig, |
@@ -138,7 +137,12 @@ describe('Test users', function () { | |||
138 | 137 | ||
139 | it('Should not be able to follow', async function () { | 138 | it('Should not be able to follow', async function () { |
140 | accessToken = 'my_super_token' | 139 | accessToken = 'my_super_token' |
141 | await follow(server.url, [ 'http://example.com' ], accessToken, HttpStatusCode.UNAUTHORIZED_401) | 140 | |
141 | await server.followsCommand.follow({ | ||
142 | targets: [ 'http://example.com' ], | ||
143 | token: accessToken, | ||
144 | expectedStatus: HttpStatusCode.UNAUTHORIZED_401 | ||
145 | }) | ||
142 | }) | 146 | }) |
143 | 147 | ||
144 | it('Should not be able to unfollow') | 148 | it('Should not be able to unfollow') |