aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/users/users.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/users/users.ts')
-rw-r--r--server/tests/api/users/users.ts28
1 files changed, 12 insertions, 16 deletions
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index 87ba775f6..6bfc7cfe5 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -2,9 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { AbuseState, AbuseUpdate, MyUser, User, UserRole, Video, VideoPlaylistType } from '@shared/models' 5import { HttpStatusCode } from '@shared/core-utils'
6import { CustomConfig, OAuth2ErrorCode } from '@shared/models/server'
7import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
8import { 6import {
9 addVideoCommentThread, 7 addVideoCommentThread,
10 blockUser, 8 blockUser,
@@ -13,13 +11,14 @@ import {
13 createUser, 11 createUser,
14 deleteMe, 12 deleteMe,
15 flushAndRunServer, 13 flushAndRunServer,
14 follow,
16 getAccountRatings, 15 getAccountRatings,
17 getAdminAbusesList,
18 getBlacklistedVideosList, 16 getBlacklistedVideosList,
19 getCustomConfig, 17 getCustomConfig,
20 getMyUserInformation, 18 getMyUserInformation,
21 getMyUserVideoQuotaUsed, 19 getMyUserVideoQuotaUsed,
22 getMyUserVideoRating, 20 getMyUserVideoRating,
21 getMyVideos,
23 getUserInformation, 22 getUserInformation,
24 getUsersList, 23 getUsersList,
25 getUsersListPaginationAndSort, 24 getUsersListPaginationAndSort,
@@ -28,18 +27,19 @@ import {
28 installPlugin, 27 installPlugin,
29 killallServers, 28 killallServers,
30 login, 29 login,
30 logout,
31 makePutBodyRequest, 31 makePutBodyRequest,
32 rateVideo, 32 rateVideo,
33 refreshToken,
33 registerUserWithChannel, 34 registerUserWithChannel,
34 removeUser, 35 removeUser,
35 removeVideo, 36 removeVideo,
36 reportAbuse,
37 reRunServer, 37 reRunServer,
38 ServerInfo, 38 ServerInfo,
39 setAccessTokensToServers,
39 setTokenField, 40 setTokenField,
40 testImage, 41 testImage,
41 unblockUser, 42 unblockUser,
42 updateAbuse,
43 updateCustomSubConfig, 43 updateCustomSubConfig,
44 updateMyAvatar, 44 updateMyAvatar,
45 updateMyUser, 45 updateMyUser,
@@ -47,11 +47,8 @@ import {
47 uploadVideo, 47 uploadVideo,
48 userLogin, 48 userLogin,
49 waitJobs 49 waitJobs
50} from '../../../../shared/extra-utils' 50} from '@shared/extra-utils'
51import { follow } from '../../../../shared/extra-utils/server/follows' 51import { AbuseState, CustomConfig, MyUser, OAuth2ErrorCode, User, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models'
52import { logout, refreshToken, setAccessTokensToServers } from '../../../../shared/extra-utils/users/login'
53import { getMyVideos } from '../../../../shared/extra-utils/videos/videos'
54import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model'
55 52
56const expect = chai.expect 53const expect = chai.expect
57 54
@@ -1002,10 +999,10 @@ describe('Test users', function () {
1002 999
1003 it('Should report correct abuses counts', async function () { 1000 it('Should report correct abuses counts', async function () {
1004 const reason = 'my super bad reason' 1001 const reason = 'my super bad reason'
1005 await reportAbuse({ url: server.url, token: user17AccessToken, videoId, reason }) 1002 await server.abusesCommand.report({ token: user17AccessToken, videoId, reason })
1006 1003
1007 const res1 = await getAdminAbusesList({ url: server.url, token: server.accessToken }) 1004 const body1 = await server.abusesCommand.getAdminList()
1008 const abuseId = res1.body.data[0].id 1005 const abuseId = body1.data[0].id
1009 1006
1010 const res2 = await getUserInformation(server.url, server.accessToken, user17Id, true) 1007 const res2 = await getUserInformation(server.url, server.accessToken, user17Id, true)
1011 const user2: User = res2.body 1008 const user2: User = res2.body
@@ -1013,8 +1010,7 @@ describe('Test users', function () {
1013 expect(user2.abusesCount).to.equal(1) // number of incriminations 1010 expect(user2.abusesCount).to.equal(1) // number of incriminations
1014 expect(user2.abusesCreatedCount).to.equal(1) // number of reports created 1011 expect(user2.abusesCreatedCount).to.equal(1) // number of reports created
1015 1012
1016 const body: AbuseUpdate = { state: AbuseState.ACCEPTED } 1013 await server.abusesCommand.update({ abuseId, body: { state: AbuseState.ACCEPTED } })
1017 await updateAbuse(server.url, server.accessToken, abuseId, body)
1018 1014
1019 const res3 = await getUserInformation(server.url, server.accessToken, user17Id, true) 1015 const res3 = await getUserInformation(server.url, server.accessToken, user17Id, true)
1020 const user3: User = res3.body 1016 const user3: User = res3.body