diff options
Diffstat (limited to 'server/tests/api/users/users.ts')
-rw-r--r-- | server/tests/api/users/users.ts | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index 7ba04a4ca..60fbd2a20 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts | |||
@@ -2,8 +2,9 @@ | |||
2 | 2 | ||
3 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
4 | import 'mocha' | 4 | import 'mocha' |
5 | import { MyUser, User, UserRole, Video, VideoPlaylistType, VideoAbuseState, VideoAbuseUpdate } from '../../../../shared/index' | 5 | import { MyUser, User, UserRole, Video, VideoAbuseState, VideoAbuseUpdate, VideoPlaylistType } from '../../../../shared/index' |
6 | import { | 6 | import { |
7 | addVideoCommentThread, | ||
7 | blockUser, | 8 | blockUser, |
8 | cleanupTests, | 9 | cleanupTests, |
9 | createUser, | 10 | createUser, |
@@ -11,12 +12,14 @@ import { | |||
11 | flushAndRunServer, | 12 | flushAndRunServer, |
12 | getAccountRatings, | 13 | getAccountRatings, |
13 | getBlacklistedVideosList, | 14 | getBlacklistedVideosList, |
15 | getCustomConfig, | ||
14 | getMyUserInformation, | 16 | getMyUserInformation, |
15 | getMyUserVideoQuotaUsed, | 17 | getMyUserVideoQuotaUsed, |
16 | getMyUserVideoRating, | 18 | getMyUserVideoRating, |
17 | getUserInformation, | 19 | getUserInformation, |
18 | getUsersList, | 20 | getUsersList, |
19 | getUsersListPaginationAndSort, | 21 | getUsersListPaginationAndSort, |
22 | getVideoAbusesList, | ||
20 | getVideoChannel, | 23 | getVideoChannel, |
21 | getVideosList, | 24 | getVideosList, |
22 | installPlugin, | 25 | installPlugin, |
@@ -26,21 +29,21 @@ import { | |||
26 | registerUserWithChannel, | 29 | registerUserWithChannel, |
27 | removeUser, | 30 | removeUser, |
28 | removeVideo, | 31 | removeVideo, |
32 | reportVideoAbuse, | ||
29 | ServerInfo, | 33 | ServerInfo, |
30 | testImage, | 34 | testImage, |
31 | unblockUser, | 35 | unblockUser, |
36 | updateCustomSubConfig, | ||
32 | updateMyAvatar, | 37 | updateMyAvatar, |
33 | updateMyUser, | 38 | updateMyUser, |
34 | updateUser, | 39 | updateUser, |
40 | updateVideoAbuse, | ||
35 | uploadVideo, | 41 | uploadVideo, |
36 | userLogin, | 42 | userLogin, |
37 | reportVideoAbuse, | 43 | waitJobs |
38 | addVideoCommentThread, | ||
39 | updateVideoAbuse, | ||
40 | getVideoAbusesList, updateCustomSubConfig, getCustomConfig, waitJobs | ||
41 | } from '../../../../shared/extra-utils' | 44 | } from '../../../../shared/extra-utils' |
42 | import { follow } from '../../../../shared/extra-utils/server/follows' | 45 | import { follow } from '../../../../shared/extra-utils/server/follows' |
43 | import { setAccessTokensToServers, logout } from '../../../../shared/extra-utils/users/login' | 46 | import { logout, serverLogin, setAccessTokensToServers } from '../../../../shared/extra-utils/users/login' |
44 | import { getMyVideos } from '../../../../shared/extra-utils/videos/videos' | 47 | import { getMyVideos } from '../../../../shared/extra-utils/videos/videos' |
45 | import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' | 48 | import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' |
46 | import { CustomConfig } from '@shared/models/server' | 49 | import { CustomConfig } from '@shared/models/server' |
@@ -60,7 +63,14 @@ describe('Test users', function () { | |||
60 | 63 | ||
61 | before(async function () { | 64 | before(async function () { |
62 | this.timeout(30000) | 65 | this.timeout(30000) |
63 | server = await flushAndRunServer(1) | 66 | |
67 | server = await flushAndRunServer(1, { | ||
68 | rates_limit: { | ||
69 | login: { | ||
70 | max: 30 | ||
71 | } | ||
72 | } | ||
73 | }) | ||
64 | 74 | ||
65 | await setAccessTokensToServers([ server ]) | 75 | await setAccessTokensToServers([ server ]) |
66 | 76 | ||
@@ -217,8 +227,6 @@ describe('Test users', function () { | |||
217 | await uploadVideo(server.url, server.accessToken, { name: 'video' }, 401) | 227 | await uploadVideo(server.url, server.accessToken, { name: 'video' }, 401) |
218 | }) | 228 | }) |
219 | 229 | ||
220 | it('Should not be able to remove a video') | ||
221 | |||
222 | it('Should not be able to rate a video', async function () { | 230 | it('Should not be able to rate a video', async function () { |
223 | const path = '/api/v1/videos/' | 231 | const path = '/api/v1/videos/' |
224 | const data = { | 232 | const data = { |
@@ -235,13 +243,17 @@ describe('Test users', function () { | |||
235 | await makePutBodyRequest(options) | 243 | await makePutBodyRequest(options) |
236 | }) | 244 | }) |
237 | 245 | ||
238 | it('Should be able to login again') | 246 | it('Should be able to login again', async function () { |
247 | server.accessToken = await serverLogin(server) | ||
248 | }) | ||
239 | 249 | ||
240 | it('Should have an expired access token') | 250 | it('Should have an expired access token') |
241 | 251 | ||
242 | it('Should refresh the token') | 252 | it('Should refresh the token') |
243 | 253 | ||
244 | it('Should be able to upload a video again') | 254 | it('Should be able to get my user information again', async function () { |
255 | await getMyUserInformation(server.url, server.accessToken) | ||
256 | }) | ||
245 | }) | 257 | }) |
246 | 258 | ||
247 | describe('Creating a user', function () { | 259 | describe('Creating a user', function () { |