aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/moderation
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/moderation')
-rw-r--r--server/tests/api/moderation/abuses.ts3
-rw-r--r--server/tests/api/moderation/blocklist-notification.ts7
-rw-r--r--server/tests/api/moderation/blocklist.ts7
-rw-r--r--server/tests/api/moderation/video-blacklist.ts5
4 files changed, 9 insertions, 13 deletions
diff --git a/server/tests/api/moderation/abuses.ts b/server/tests/api/moderation/abuses.ts
index e428cf1a8..d7462f38f 100644
--- a/server/tests/api/moderation/abuses.ts
+++ b/server/tests/api/moderation/abuses.ts
@@ -17,7 +17,6 @@ import {
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 uploadVideo, 18 uploadVideo,
19 uploadVideoAndGetId, 19 uploadVideoAndGetId,
20 userLogin,
21 waitJobs 20 waitJobs
22} from '@shared/extra-utils' 21} from '@shared/extra-utils'
23import { AbuseMessage, AbusePredefinedReasonsString, AbuseState, AdminAbuse, UserAbuse } from '@shared/models' 22import { AbuseMessage, AbusePredefinedReasonsString, AbuseState, AdminAbuse, UserAbuse } from '@shared/models'
@@ -280,7 +279,7 @@ describe('Test abuses', function () {
280 // register a second user to have two reporters/reportees 279 // register a second user to have two reporters/reportees
281 const user = { username: 'user2', password: 'password' } 280 const user = { username: 'user2', password: 'password' }
282 await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, ...user }) 281 await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, ...user })
283 const userAccessToken = await userLogin(servers[0], user) 282 const userAccessToken = await servers[0].loginCommand.getAccessToken(user)
284 283
285 // upload a third video via this user 284 // upload a third video via this user
286 const video3Attributes = { 285 const video3Attributes = {
diff --git a/server/tests/api/moderation/blocklist-notification.ts b/server/tests/api/moderation/blocklist-notification.ts
index b676a4db4..4f2be6198 100644
--- a/server/tests/api/moderation/blocklist-notification.ts
+++ b/server/tests/api/moderation/blocklist-notification.ts
@@ -10,7 +10,6 @@ import {
10 ServerInfo, 10 ServerInfo,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 uploadVideo, 12 uploadVideo,
13 userLogin,
14 waitJobs 13 waitJobs
15} from '@shared/extra-utils' 14} from '@shared/extra-utils'
16import { UserNotificationType } from '@shared/models' 15import { UserNotificationType } from '@shared/models'
@@ -86,7 +85,7 @@ describe('Test blocklist', function () {
86 videoQuotaDaily: -1 85 videoQuotaDaily: -1
87 }) 86 })
88 87
89 userToken1 = await userLogin(servers[0], user) 88 userToken1 = await servers[0].loginCommand.getAccessToken(user)
90 await uploadVideo(servers[0].url, userToken1, { name: 'video user 1' }) 89 await uploadVideo(servers[0].url, userToken1, { name: 'video user 1' })
91 } 90 }
92 91
@@ -94,14 +93,14 @@ describe('Test blocklist', function () {
94 const user = { username: 'user2', password: 'password' } 93 const user = { username: 'user2', password: 'password' }
95 await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password }) 94 await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password })
96 95
97 userToken2 = await userLogin(servers[0], user) 96 userToken2 = await servers[0].loginCommand.getAccessToken(user)
98 } 97 }
99 98
100 { 99 {
101 const user = { username: 'user3', password: 'password' } 100 const user = { username: 'user3', password: 'password' }
102 await createUser({ url: servers[1].url, accessToken: servers[1].accessToken, username: user.username, password: user.password }) 101 await createUser({ url: servers[1].url, accessToken: servers[1].accessToken, username: user.username, password: user.password })
103 102
104 remoteUserToken = await userLogin(servers[1], user) 103 remoteUserToken = await servers[1].loginCommand.getAccessToken(user)
105 } 104 }
106 105
107 await doubleFollow(servers[0], servers[1]) 106 await doubleFollow(servers[0], servers[1])
diff --git a/server/tests/api/moderation/blocklist.ts b/server/tests/api/moderation/blocklist.ts
index 44e3de4e4..c38a7dad4 100644
--- a/server/tests/api/moderation/blocklist.ts
+++ b/server/tests/api/moderation/blocklist.ts
@@ -14,7 +14,6 @@ import {
14 ServerInfo, 14 ServerInfo,
15 setAccessTokensToServers, 15 setAccessTokensToServers,
16 uploadVideo, 16 uploadVideo,
17 userLogin,
18 waitJobs 17 waitJobs
19} from '@shared/extra-utils' 18} from '@shared/extra-utils'
20import { UserNotificationType, Video } from '@shared/models' 19import { UserNotificationType, Video } from '@shared/models'
@@ -94,7 +93,7 @@ describe('Test blocklist', function () {
94 const user = { username: 'user1', password: 'password' } 93 const user = { username: 'user1', password: 'password' }
95 await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password }) 94 await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password })
96 95
97 userToken1 = await userLogin(servers[0], user) 96 userToken1 = await servers[0].loginCommand.getAccessToken(user)
98 await uploadVideo(servers[0].url, userToken1, { name: 'video user 1' }) 97 await uploadVideo(servers[0].url, userToken1, { name: 'video user 1' })
99 } 98 }
100 99
@@ -102,14 +101,14 @@ describe('Test blocklist', function () {
102 const user = { username: 'moderator', password: 'password' } 101 const user = { username: 'moderator', password: 'password' }
103 await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password }) 102 await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password })
104 103
105 userModeratorToken = await userLogin(servers[0], user) 104 userModeratorToken = await servers[0].loginCommand.getAccessToken(user)
106 } 105 }
107 106
108 { 107 {
109 const user = { username: 'user2', password: 'password' } 108 const user = { username: 'user2', password: 'password' }
110 await createUser({ url: servers[1].url, accessToken: servers[1].accessToken, username: user.username, password: user.password }) 109 await createUser({ url: servers[1].url, accessToken: servers[1].accessToken, username: user.username, password: user.password })
111 110
112 userToken2 = await userLogin(servers[1], user) 111 userToken2 = await servers[1].loginCommand.getAccessToken(user)
113 await uploadVideo(servers[1].url, userToken2, { name: 'video user 2' }) 112 await uploadVideo(servers[1].url, userToken2, { name: 'video user 2' })
114 } 113 }
115 114
diff --git a/server/tests/api/moderation/video-blacklist.ts b/server/tests/api/moderation/video-blacklist.ts
index 8b4723a2b..b61effc57 100644
--- a/server/tests/api/moderation/video-blacklist.ts
+++ b/server/tests/api/moderation/video-blacklist.ts
@@ -19,7 +19,6 @@ import {
19 setAccessTokensToServers, 19 setAccessTokensToServers,
20 updateVideo, 20 updateVideo,
21 uploadVideo, 21 uploadVideo,
22 userLogin,
23 waitJobs 22 waitJobs
24} from '@shared/extra-utils' 23} from '@shared/extra-utils'
25import { User, UserAdminFlag, UserRole, VideoBlacklist, VideoBlacklistType } from '@shared/models' 24import { User, UserAdminFlag, UserRole, VideoBlacklist, VideoBlacklistType } from '@shared/models'
@@ -366,7 +365,7 @@ describe('Test video blacklist', function () {
366 role: UserRole.USER 365 role: UserRole.USER
367 }) 366 })
368 367
369 userWithoutFlag = await userLogin(servers[0], user) 368 userWithoutFlag = await servers[0].loginCommand.getAccessToken(user)
370 369
371 const res = await getMyUserInformation(servers[0].url, userWithoutFlag) 370 const res = await getMyUserInformation(servers[0].url, userWithoutFlag)
372 const body: User = res.body 371 const body: User = res.body
@@ -384,7 +383,7 @@ describe('Test video blacklist', function () {
384 role: UserRole.USER 383 role: UserRole.USER
385 }) 384 })
386 385
387 userWithFlag = await userLogin(servers[0], user) 386 userWithFlag = await servers[0].loginCommand.getAccessToken(user)
388 } 387 }
389 388
390 await waitJobs(servers) 389 await waitJobs(servers)