aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-13 11:05:15 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit41d1d075011174e73dccb74006181a92a618d7b4 (patch)
tree4dc1af0e266977f062cf9716837d04de1cdd628d /server/tests/api/check-params
parent6c5065a011b099618681a37bd77eaa7bd3db752e (diff)
downloadPeerTube-41d1d075011174e73dccb74006181a92a618d7b4.tar.gz
PeerTube-41d1d075011174e73dccb74006181a92a618d7b4.tar.zst
PeerTube-41d1d075011174e73dccb74006181a92a618d7b4.zip
Introduce login command
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r--server/tests/api/check-params/abuses.ts3
-rw-r--r--server/tests/api/check-params/blocklist.ts5
-rw-r--r--server/tests/api/check-params/bulk.ts5
-rw-r--r--server/tests/api/check-params/config.ts5
-rw-r--r--server/tests/api/check-params/custom-pages.ts5
-rw-r--r--server/tests/api/check-params/debug.ts5
-rw-r--r--server/tests/api/check-params/follows.ts5
-rw-r--r--server/tests/api/check-params/jobs.ts5
-rw-r--r--server/tests/api/check-params/live.ts7
-rw-r--r--server/tests/api/check-params/logs.ts5
-rw-r--r--server/tests/api/check-params/plugins.ts5
-rw-r--r--server/tests/api/check-params/redundancy.ts3
-rw-r--r--server/tests/api/check-params/upload-quota.ts5
-rw-r--r--server/tests/api/check-params/user-subscriptions.ts5
-rw-r--r--server/tests/api/check-params/users.ts9
-rw-r--r--server/tests/api/check-params/video-blacklist.ts5
-rw-r--r--server/tests/api/check-params/video-captions.ts5
-rw-r--r--server/tests/api/check-params/video-channels.ts5
-rw-r--r--server/tests/api/check-params/video-comments.ts7
-rw-r--r--server/tests/api/check-params/video-imports.ts7
-rw-r--r--server/tests/api/check-params/videos-filter.ts7
-rw-r--r--server/tests/api/check-params/videos.ts7
22 files changed, 49 insertions, 71 deletions
diff --git a/server/tests/api/check-params/abuses.ts b/server/tests/api/check-params/abuses.ts
index e158e50dc..14949d301 100644
--- a/server/tests/api/check-params/abuses.ts
+++ b/server/tests/api/check-params/abuses.ts
@@ -18,7 +18,6 @@ import {
18 ServerInfo, 18 ServerInfo,
19 setAccessTokensToServers, 19 setAccessTokensToServers,
20 uploadVideo, 20 uploadVideo,
21 userLogin,
22 waitJobs 21 waitJobs
23} from '@shared/extra-utils' 22} from '@shared/extra-utils'
24import { AbuseCreate, AbuseState } from '@shared/models' 23import { AbuseCreate, AbuseState } from '@shared/models'
@@ -47,7 +46,7 @@ describe('Test abuses API validators', function () {
47 const username = 'user1' 46 const username = 'user1'
48 const password = 'my super password' 47 const password = 'my super password'
49 await createUser({ url: server.url, accessToken: server.accessToken, username: username, password: password }) 48 await createUser({ url: server.url, accessToken: server.accessToken, username: username, password: password })
50 userToken = await userLogin(server, { username, password }) 49 userToken = await server.loginCommand.getAccessToken({ username, password })
51 50
52 userToken2 = await generateUserAccessToken(server, 'user_2') 51 userToken2 = await generateUserAccessToken(server, 'user_2')
53 52
diff --git a/server/tests/api/check-params/blocklist.ts b/server/tests/api/check-params/blocklist.ts
index 5ed8810ce..11a79387f 100644
--- a/server/tests/api/check-params/blocklist.ts
+++ b/server/tests/api/check-params/blocklist.ts
@@ -11,8 +11,7 @@ import {
11 makeGetRequest, 11 makeGetRequest,
12 makePostBodyRequest, 12 makePostBodyRequest,
13 ServerInfo, 13 ServerInfo,
14 setAccessTokensToServers, 14 setAccessTokensToServers
15 userLogin
16} from '../../../../shared/extra-utils' 15} from '../../../../shared/extra-utils'
17import { 16import {
18 checkBadCountPagination, 17 checkBadCountPagination,
@@ -37,7 +36,7 @@ describe('Test blocklist API validators', function () {
37 const user = { username: 'user1', password: 'password' } 36 const user = { username: 'user1', password: 'password' }
38 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 37 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
39 38
40 userAccessToken = await userLogin(server, user) 39 userAccessToken = await server.loginCommand.getAccessToken(user)
41 40
42 await doubleFollow(servers[0], servers[1]) 41 await doubleFollow(servers[0], servers[1])
43 }) 42 })
diff --git a/server/tests/api/check-params/bulk.ts b/server/tests/api/check-params/bulk.ts
index 07b920ba7..85520b3bd 100644
--- a/server/tests/api/check-params/bulk.ts
+++ b/server/tests/api/check-params/bulk.ts
@@ -6,8 +6,7 @@ import {
6 createUser, 6 createUser,
7 flushAndRunServer, 7 flushAndRunServer,
8 ServerInfo, 8 ServerInfo,
9 setAccessTokensToServers, 9 setAccessTokensToServers
10 userLogin
11} from '../../../../shared/extra-utils' 10} from '../../../../shared/extra-utils'
12import { makePostBodyRequest } from '../../../../shared/extra-utils/requests/requests' 11import { makePostBodyRequest } from '../../../../shared/extra-utils/requests/requests'
13import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 12import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
@@ -27,7 +26,7 @@ describe('Test bulk API validators', function () {
27 const user = { username: 'user1', password: 'password' } 26 const user = { username: 'user1', password: 'password' }
28 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 27 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
29 28
30 userAccessToken = await userLogin(server, user) 29 userAccessToken = await server.loginCommand.getAccessToken(user)
31 }) 30 })
32 31
33 describe('When removing comments of', function () { 32 describe('When removing comments of', function () {
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts
index 291de93ea..e93523e4b 100644
--- a/server/tests/api/check-params/config.ts
+++ b/server/tests/api/check-params/config.ts
@@ -11,8 +11,7 @@ import {
11 makeGetRequest, 11 makeGetRequest,
12 makePutBodyRequest, 12 makePutBodyRequest,
13 ServerInfo, 13 ServerInfo,
14 setAccessTokensToServers, 14 setAccessTokensToServers
15 userLogin
16} from '@shared/extra-utils' 15} from '@shared/extra-utils'
17import { CustomConfig } from '@shared/models' 16import { CustomConfig } from '@shared/models'
18 17
@@ -208,7 +207,7 @@ describe('Test config API validators', function () {
208 password: 'password' 207 password: 'password'
209 } 208 }
210 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 209 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
211 userAccessToken = await userLogin(server, user) 210 userAccessToken = await server.loginCommand.getAccessToken(user)
212 }) 211 })
213 212
214 describe('When getting the configuration', function () { 213 describe('When getting the configuration', function () {
diff --git a/server/tests/api/check-params/custom-pages.ts b/server/tests/api/check-params/custom-pages.ts
index 74ca3384c..c1dd258aa 100644
--- a/server/tests/api/check-params/custom-pages.ts
+++ b/server/tests/api/check-params/custom-pages.ts
@@ -7,8 +7,7 @@ import {
7 createUser, 7 createUser,
8 flushAndRunServer, 8 flushAndRunServer,
9 ServerInfo, 9 ServerInfo,
10 setAccessTokensToServers, 10 setAccessTokensToServers
11 userLogin
12} from '../../../../shared/extra-utils' 11} from '../../../../shared/extra-utils'
13import { makeGetRequest, makePutBodyRequest } from '../../../../shared/extra-utils/requests/requests' 12import { makeGetRequest, makePutBodyRequest } from '../../../../shared/extra-utils/requests/requests'
14 13
@@ -29,7 +28,7 @@ describe('Test custom pages validators', function () {
29 const user = { username: 'user1', password: 'password' } 28 const user = { username: 'user1', password: 'password' }
30 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 29 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
31 30
32 userAccessToken = await userLogin(server, user) 31 userAccessToken = await server.loginCommand.getAccessToken(user)
33 }) 32 })
34 33
35 describe('When updating instance homepage', function () { 34 describe('When updating instance homepage', function () {
diff --git a/server/tests/api/check-params/debug.ts b/server/tests/api/check-params/debug.ts
index 37bf0f99b..dc033a441 100644
--- a/server/tests/api/check-params/debug.ts
+++ b/server/tests/api/check-params/debug.ts
@@ -7,8 +7,7 @@ import {
7 createUser, 7 createUser,
8 flushAndRunServer, 8 flushAndRunServer,
9 ServerInfo, 9 ServerInfo,
10 setAccessTokensToServers, 10 setAccessTokensToServers
11 userLogin
12} from '../../../../shared/extra-utils' 11} from '../../../../shared/extra-utils'
13import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests' 12import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests'
14import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 13import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
@@ -32,7 +31,7 @@ describe('Test debug API validators', function () {
32 password: 'my super password' 31 password: 'my super password'
33 } 32 }
34 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 33 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
35 userAccessToken = await userLogin(server, user) 34 userAccessToken = await server.loginCommand.getAccessToken(user)
36 }) 35 })
37 36
38 describe('When getting debug endpoint', function () { 37 describe('When getting debug endpoint', function () {
diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.ts
index c03dd5c9c..8cf5b130e 100644
--- a/server/tests/api/check-params/follows.ts
+++ b/server/tests/api/check-params/follows.ts
@@ -9,8 +9,7 @@ import {
9 makeDeleteRequest, makeGetRequest, 9 makeDeleteRequest, makeGetRequest,
10 makePostBodyRequest, 10 makePostBodyRequest,
11 ServerInfo, 11 ServerInfo,
12 setAccessTokensToServers, 12 setAccessTokensToServers
13 userLogin
14} from '../../../../shared/extra-utils' 13} from '../../../../shared/extra-utils'
15import { 14import {
16 checkBadCountPagination, 15 checkBadCountPagination,
@@ -42,7 +41,7 @@ describe('Test server follows API validators', function () {
42 } 41 }
43 42
44 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 43 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
45 userAccessToken = await userLogin(server, user) 44 userAccessToken = await server.loginCommand.getAccessToken(user)
46 }) 45 })
47 46
48 describe('When adding follows', function () { 47 describe('When adding follows', function () {
diff --git a/server/tests/api/check-params/jobs.ts b/server/tests/api/check-params/jobs.ts
index 3c1d2049b..cbe6a28b8 100644
--- a/server/tests/api/check-params/jobs.ts
+++ b/server/tests/api/check-params/jobs.ts
@@ -7,8 +7,7 @@ import {
7 createUser, 7 createUser,
8 flushAndRunServer, 8 flushAndRunServer,
9 ServerInfo, 9 ServerInfo,
10 setAccessTokensToServers, 10 setAccessTokensToServers
11 userLogin
12} from '../../../../shared/extra-utils' 11} from '../../../../shared/extra-utils'
13import { 12import {
14 checkBadCountPagination, 13 checkBadCountPagination,
@@ -37,7 +36,7 @@ describe('Test jobs API validators', function () {
37 password: 'my super password' 36 password: 'my super password'
38 } 37 }
39 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 38 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
40 userAccessToken = await userLogin(server, user) 39 userAccessToken = await server.loginCommand.getAccessToken(user)
41 }) 40 })
42 41
43 describe('When listing jobs', function () { 42 describe('When listing jobs', function () {
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts
index 394967285..045f3a1b1 100644
--- a/server/tests/api/check-params/live.ts
+++ b/server/tests/api/check-params/live.ts
@@ -17,8 +17,7 @@ import {
17 ServerInfo, 17 ServerInfo,
18 setAccessTokensToServers, 18 setAccessTokensToServers,
19 stopFfmpeg, 19 stopFfmpeg,
20 uploadVideoAndGetId, 20 uploadVideoAndGetId
21 userLogin
22} from '../../../../shared/extra-utils' 21} from '../../../../shared/extra-utils'
23 22
24describe('Test video lives API validator', function () { 23describe('Test video lives API validator', function () {
@@ -53,7 +52,7 @@ describe('Test video lives API validator', function () {
53 const username = 'user1' 52 const username = 'user1'
54 const password = 'my super password' 53 const password = 'my super password'
55 await createUser({ url: server.url, accessToken: server.accessToken, username: username, password: password }) 54 await createUser({ url: server.url, accessToken: server.accessToken, username: username, password: password })
56 userAccessToken = await userLogin(server, { username, password }) 55 userAccessToken = await server.loginCommand.getAccessToken({ username, password })
57 56
58 { 57 {
59 const res = await getMyUserInformation(server.url, server.accessToken) 58 const res = await getMyUserInformation(server.url, server.accessToken)
@@ -150,7 +149,7 @@ describe('Test video lives API validator', function () {
150 } 149 }
151 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 150 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
152 151
153 const accessTokenUser = await userLogin(server, user) 152 const accessTokenUser = await server.loginCommand.getAccessToken(user)
154 const res = await getMyUserInformation(server.url, accessTokenUser) 153 const res = await getMyUserInformation(server.url, accessTokenUser)
155 const customChannelId = res.body.videoChannels[0].id 154 const customChannelId = res.body.videoChannels[0].id
156 155
diff --git a/server/tests/api/check-params/logs.ts b/server/tests/api/check-params/logs.ts
index dac1e6b98..83ecfec93 100644
--- a/server/tests/api/check-params/logs.ts
+++ b/server/tests/api/check-params/logs.ts
@@ -7,8 +7,7 @@ import {
7 createUser, 7 createUser,
8 flushAndRunServer, 8 flushAndRunServer,
9 ServerInfo, 9 ServerInfo,
10 setAccessTokensToServers, 10 setAccessTokensToServers
11 userLogin
12} from '../../../../shared/extra-utils' 11} from '../../../../shared/extra-utils'
13import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests' 12import { makeGetRequest } from '../../../../shared/extra-utils/requests/requests'
14import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 13import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
@@ -32,7 +31,7 @@ describe('Test logs API validators', function () {
32 password: 'my super password' 31 password: 'my super password'
33 } 32 }
34 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 33 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
35 userAccessToken = await userLogin(server, user) 34 userAccessToken = await server.loginCommand.getAccessToken(user)
36 }) 35 })
37 36
38 describe('When getting logs', function () { 37 describe('When getting logs', function () {
diff --git a/server/tests/api/check-params/plugins.ts b/server/tests/api/check-params/plugins.ts
index 8509b8ac5..130cf6869 100644
--- a/server/tests/api/check-params/plugins.ts
+++ b/server/tests/api/check-params/plugins.ts
@@ -13,8 +13,7 @@ import {
13 makePostBodyRequest, 13 makePostBodyRequest,
14 makePutBodyRequest, 14 makePutBodyRequest,
15 ServerInfo, 15 ServerInfo,
16 setAccessTokensToServers, 16 setAccessTokensToServers
17 userLogin
18} from '@shared/extra-utils' 17} from '@shared/extra-utils'
19import { PeerTubePlugin, PluginType } from '@shared/models' 18import { PeerTubePlugin, PluginType } from '@shared/models'
20 19
@@ -45,7 +44,7 @@ describe('Test server plugins API validators', function () {
45 } 44 }
46 45
47 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 46 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
48 userAccessToken = await userLogin(server, user) 47 userAccessToken = await server.loginCommand.getAccessToken(user)
49 48
50 { 49 {
51 const res = await server.pluginsCommand.install({ npmName: npmPlugin }) 50 const res = await server.pluginsCommand.install({ npmName: npmPlugin })
diff --git a/server/tests/api/check-params/redundancy.ts b/server/tests/api/check-params/redundancy.ts
index dac6938de..2e10e378a 100644
--- a/server/tests/api/check-params/redundancy.ts
+++ b/server/tests/api/check-params/redundancy.ts
@@ -19,7 +19,6 @@ import {
19 ServerInfo, 19 ServerInfo,
20 setAccessTokensToServers, 20 setAccessTokensToServers,
21 uploadVideoAndGetId, 21 uploadVideoAndGetId,
22 userLogin,
23 waitJobs 22 waitJobs
24} from '../../../../shared/extra-utils' 23} from '../../../../shared/extra-utils'
25 24
@@ -45,7 +44,7 @@ describe('Test server redundancy API validators', function () {
45 } 44 }
46 45
47 await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password }) 46 await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: user.username, password: user.password })
48 userAccessToken = await userLogin(servers[0], user) 47 userAccessToken = await servers[0].loginCommand.getAccessToken(user)
49 48
50 videoIdLocal = (await uploadVideoAndGetId({ server: servers[0], videoName: 'video' })).id 49 videoIdLocal = (await uploadVideoAndGetId({ server: servers[0], videoName: 'video' })).id
51 50
diff --git a/server/tests/api/check-params/upload-quota.ts b/server/tests/api/check-params/upload-quota.ts
index c444663b8..3dc6cf2b4 100644
--- a/server/tests/api/check-params/upload-quota.ts
+++ b/server/tests/api/check-params/upload-quota.ts
@@ -15,7 +15,6 @@ import {
15 setDefaultVideoChannel, 15 setDefaultVideoChannel,
16 updateUser, 16 updateUser,
17 uploadVideo, 17 uploadVideo,
18 userLogin,
19 waitJobs 18 waitJobs
20} from '../../../../shared/extra-utils' 19} from '../../../../shared/extra-utils'
21 20
@@ -50,7 +49,7 @@ describe('Test upload quota', function () {
50 49
51 const user = { username: 'registered' + randomInt(1, 1500), password: 'password' } 50 const user = { username: 'registered' + randomInt(1, 1500), password: 'password' }
52 await registerUser(server.url, user.username, user.password) 51 await registerUser(server.url, user.username, user.password)
53 const userAccessToken = await userLogin(server, user) 52 const userAccessToken = await server.loginCommand.getAccessToken(user)
54 53
55 const videoAttributes = { fixture: 'video_short2.webm' } 54 const videoAttributes = { fixture: 'video_short2.webm' }
56 for (let i = 0; i < 5; i++) { 55 for (let i = 0; i < 5; i++) {
@@ -65,7 +64,7 @@ describe('Test upload quota', function () {
65 64
66 const user = { username: 'registered' + randomInt(1, 1500), password: 'password' } 65 const user = { username: 'registered' + randomInt(1, 1500), password: 'password' }
67 await registerUser(server.url, user.username, user.password) 66 await registerUser(server.url, user.username, user.password)
68 const userAccessToken = await userLogin(server, user) 67 const userAccessToken = await server.loginCommand.getAccessToken(user)
69 68
70 const videoAttributes = { fixture: 'video_short2.webm' } 69 const videoAttributes = { fixture: 'video_short2.webm' }
71 for (let i = 0; i < 5; i++) { 70 for (let i = 0; i < 5; i++) {
diff --git a/server/tests/api/check-params/user-subscriptions.ts b/server/tests/api/check-params/user-subscriptions.ts
index 538201647..64e2703b9 100644
--- a/server/tests/api/check-params/user-subscriptions.ts
+++ b/server/tests/api/check-params/user-subscriptions.ts
@@ -10,8 +10,7 @@ import {
10 makeGetRequest, 10 makeGetRequest,
11 makePostBodyRequest, 11 makePostBodyRequest,
12 ServerInfo, 12 ServerInfo,
13 setAccessTokensToServers, 13 setAccessTokensToServers
14 userLogin
15} from '../../../../shared/extra-utils' 14} from '../../../../shared/extra-utils'
16 15
17import { 16import {
@@ -41,7 +40,7 @@ describe('Test user subscriptions API validators', function () {
41 password: 'my super password' 40 password: 'my super password'
42 } 41 }
43 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 42 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
44 userAccessToken = await userLogin(server, user) 43 userAccessToken = await server.loginCommand.getAccessToken(user)
45 }) 44 })
46 45
47 describe('When listing my subscriptions', function () { 46 describe('When listing my subscriptions', function () {
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index fda7e9640..54baeebe1 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -27,8 +27,7 @@ import {
27 ServerInfo, 27 ServerInfo,
28 setAccessTokensToServers, 28 setAccessTokensToServers,
29 unblockUser, 29 unblockUser,
30 uploadVideo, 30 uploadVideo
31 userLogin
32} from '../../../../shared/extra-utils' 31} from '../../../../shared/extra-utils'
33import { MockSmtpServer } from '../../../../shared/extra-utils/mock-servers/mock-email' 32import { MockSmtpServer } from '../../../../shared/extra-utils/mock-servers/mock-email'
34import { 33import {
@@ -87,7 +86,7 @@ describe('Test users API validators', function () {
87 password: user.password, 86 password: user.password,
88 videoQuota: videoQuota 87 videoQuota: videoQuota
89 }) 88 })
90 userAccessToken = await userLogin(server, user) 89 userAccessToken = await server.loginCommand.getAccessToken(user)
91 } 90 }
92 91
93 { 92 {
@@ -104,7 +103,7 @@ describe('Test users API validators', function () {
104 role: UserRole.MODERATOR 103 role: UserRole.MODERATOR
105 }) 104 })
106 105
107 moderatorAccessToken = await userLogin(server, moderator) 106 moderatorAccessToken = await server.loginCommand.getAccessToken(moderator)
108 } 107 }
109 108
110 { 109 {
@@ -394,7 +393,7 @@ describe('Test users API validators', function () {
394 username: 'user1', 393 username: 'user1',
395 password: 'my super password' 394 password: 'my super password'
396 } 395 }
397 userAccessToken = await userLogin(server, user) 396 userAccessToken = await server.loginCommand.getAccessToken(user)
398 397
399 const fields = { 398 const fields = {
400 username: 'user3', 399 username: 'user3',
diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.ts
index 98cf2e11a..c33bc196d 100644
--- a/server/tests/api/check-params/video-blacklist.ts
+++ b/server/tests/api/check-params/video-blacklist.ts
@@ -19,7 +19,6 @@ import {
19 ServerInfo, 19 ServerInfo,
20 setAccessTokensToServers, 20 setAccessTokensToServers,
21 uploadVideo, 21 uploadVideo,
22 userLogin,
23 waitJobs 22 waitJobs
24} from '@shared/extra-utils' 23} from '@shared/extra-utils'
25import { VideoBlacklistType, VideoDetails } from '@shared/models' 24import { VideoBlacklistType, VideoDetails } from '@shared/models'
@@ -46,14 +45,14 @@ describe('Test video blacklist API validators', function () {
46 const username = 'user1' 45 const username = 'user1'
47 const password = 'my super password' 46 const password = 'my super password'
48 await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: username, password: password }) 47 await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: username, password: password })
49 userAccessToken1 = await userLogin(servers[0], { username, password }) 48 userAccessToken1 = await servers[0].loginCommand.getAccessToken({ username, password })
50 } 49 }
51 50
52 { 51 {
53 const username = 'user2' 52 const username = 'user2'
54 const password = 'my super password' 53 const password = 'my super password'
55 await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: username, password: password }) 54 await createUser({ url: servers[0].url, accessToken: servers[0].accessToken, username: username, password: password })
56 userAccessToken2 = await userLogin(servers[0], { username, password }) 55 userAccessToken2 = await servers[0].loginCommand.getAccessToken({ username, password })
57 } 56 }
58 57
59 { 58 {
diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts
index baab0f276..f2fd61b91 100644
--- a/server/tests/api/check-params/video-captions.ts
+++ b/server/tests/api/check-params/video-captions.ts
@@ -12,8 +12,7 @@ import {
12 makeUploadRequest, 12 makeUploadRequest,
13 ServerInfo, 13 ServerInfo,
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 uploadVideo, 15 uploadVideo
16 userLogin
17} from '@shared/extra-utils' 16} from '@shared/extra-utils'
18import { VideoCreateResult } from '@shared/models' 17import { VideoCreateResult } from '@shared/models'
19 18
@@ -44,7 +43,7 @@ describe('Test video captions API validator', function () {
44 password: 'my super password' 43 password: 'my super password'
45 } 44 }
46 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 45 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
47 userAccessToken = await userLogin(server, user) 46 userAccessToken = await server.loginCommand.getAccessToken(user)
48 } 47 }
49 }) 48 })
50 49
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts
index 3b72d3796..5361f6917 100644
--- a/server/tests/api/check-params/video-channels.ts
+++ b/server/tests/api/check-params/video-channels.ts
@@ -18,8 +18,7 @@ import {
18 makePutBodyRequest, 18 makePutBodyRequest,
19 makeUploadRequest, 19 makeUploadRequest,
20 ServerInfo, 20 ServerInfo,
21 setAccessTokensToServers, 21 setAccessTokensToServers
22 userLogin
23} from '@shared/extra-utils' 22} from '@shared/extra-utils'
24import { VideoChannelUpdate } from '@shared/models' 23import { VideoChannelUpdate } from '@shared/models'
25 24
@@ -47,7 +46,7 @@ describe('Test video channels API validator', function () {
47 46
48 { 47 {
49 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 48 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
50 accessTokenUser = await userLogin(server, user) 49 accessTokenUser = await server.loginCommand.getAccessToken(user)
51 } 50 }
52 51
53 command = server.channelsCommand 52 command = server.channelsCommand
diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts
index 0f8c81392..c21aebaae 100644
--- a/server/tests/api/check-params/video-comments.ts
+++ b/server/tests/api/check-params/video-comments.ts
@@ -15,8 +15,7 @@ import {
15 makePostBodyRequest, 15 makePostBodyRequest,
16 ServerInfo, 16 ServerInfo,
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 uploadVideo, 18 uploadVideo
19 userLogin
20} from '@shared/extra-utils' 19} from '@shared/extra-utils'
21import { VideoCreateResult } from '@shared/models' 20import { VideoCreateResult } from '@shared/models'
22 21
@@ -55,13 +54,13 @@ describe('Test video comments API validator', function () {
55 { 54 {
56 const user = { username: 'user1', password: 'my super password' } 55 const user = { username: 'user1', password: 'my super password' }
57 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 56 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
58 userAccessToken = await userLogin(server, user) 57 userAccessToken = await server.loginCommand.getAccessToken(user)
59 } 58 }
60 59
61 { 60 {
62 const user = { username: 'user2', password: 'my super password' } 61 const user = { username: 'user2', password: 'my super password' }
63 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 62 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
64 userAccessToken2 = await userLogin(server, user) 63 userAccessToken2 = await server.loginCommand.getAccessToken(user)
65 } 64 }
66 }) 65 })
67 66
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts
index 2cc124cc1..51260affa 100644
--- a/server/tests/api/check-params/video-imports.ts
+++ b/server/tests/api/check-params/video-imports.ts
@@ -17,8 +17,7 @@ import {
17 makePostBodyRequest, 17 makePostBodyRequest,
18 makeUploadRequest, 18 makeUploadRequest,
19 ServerInfo, 19 ServerInfo,
20 setAccessTokensToServers, 20 setAccessTokensToServers
21 userLogin
22} from '@shared/extra-utils' 21} from '@shared/extra-utils'
23import { VideoPrivacy } from '@shared/models' 22import { VideoPrivacy } from '@shared/models'
24 23
@@ -40,7 +39,7 @@ describe('Test video imports API validator', function () {
40 const username = 'user1' 39 const username = 'user1'
41 const password = 'my super password' 40 const password = 'my super password'
42 await createUser({ url: server.url, accessToken: server.accessToken, username: username, password: password }) 41 await createUser({ url: server.url, accessToken: server.accessToken, username: username, password: password })
43 userAccessToken = await userLogin(server, { username, password }) 42 userAccessToken = await server.loginCommand.getAccessToken({ username, password })
44 43
45 { 44 {
46 const res = await getMyUserInformation(server.url, server.accessToken) 45 const res = await getMyUserInformation(server.url, server.accessToken)
@@ -167,7 +166,7 @@ describe('Test video imports API validator', function () {
167 } 166 }
168 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 167 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
169 168
170 const accessTokenUser = await userLogin(server, user) 169 const accessTokenUser = await server.loginCommand.getAccessToken(user)
171 const res = await getMyUserInformation(server.url, accessTokenUser) 170 const res = await getMyUserInformation(server.url, accessTokenUser)
172 const customChannelId = res.body.videoChannels[0].id 171 const customChannelId = res.body.videoChannels[0].id
173 172
diff --git a/server/tests/api/check-params/videos-filter.ts b/server/tests/api/check-params/videos-filter.ts
index 4d54a4fd0..095b94656 100644
--- a/server/tests/api/check-params/videos-filter.ts
+++ b/server/tests/api/check-params/videos-filter.ts
@@ -8,8 +8,7 @@ import {
8 makeGetRequest, 8 makeGetRequest,
9 ServerInfo, 9 ServerInfo,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 setDefaultVideoChannel, 11 setDefaultVideoChannel
12 userLogin
13} from '../../../../shared/extra-utils' 12} from '../../../../shared/extra-utils'
14import { UserRole } from '../../../../shared/models/users' 13import { UserRole } from '../../../../shared/models/users'
15import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 14import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
@@ -52,7 +51,7 @@ describe('Test video filters validators', function () {
52 51
53 const user = { username: 'user1', password: 'my super password' } 52 const user = { username: 'user1', password: 'my super password' }
54 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 53 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
55 userAccessToken = await userLogin(server, user) 54 userAccessToken = await server.loginCommand.getAccessToken(user)
56 55
57 const moderator = { username: 'moderator', password: 'my super password' } 56 const moderator = { username: 'moderator', password: 'my super password' }
58 await createUser( 57 await createUser(
@@ -66,7 +65,7 @@ describe('Test video filters validators', function () {
66 role: UserRole.MODERATOR 65 role: UserRole.MODERATOR
67 } 66 }
68 ) 67 )
69 moderatorAccessToken = await userLogin(server, moderator) 68 moderatorAccessToken = await server.loginCommand.getAccessToken(moderator)
70 }) 69 })
71 70
72 describe('When setting a video filter', function () { 71 describe('When setting a video filter', function () {
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index 6549063b1..8e11232bd 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -22,8 +22,7 @@ import {
22 removeVideo, 22 removeVideo,
23 root, 23 root,
24 ServerInfo, 24 ServerInfo,
25 setAccessTokensToServers, 25 setAccessTokensToServers
26 userLogin
27} from '../../../../shared/extra-utils' 26} from '../../../../shared/extra-utils'
28import { 27import {
29 checkBadCountPagination, 28 checkBadCountPagination,
@@ -55,7 +54,7 @@ describe('Test videos API validator', function () {
55 const username = 'user1' 54 const username = 'user1'
56 const password = 'my super password' 55 const password = 'my super password'
57 await createUser({ url: server.url, accessToken: server.accessToken, username: username, password: password }) 56 await createUser({ url: server.url, accessToken: server.accessToken, username: username, password: password })
58 userAccessToken = await userLogin(server, { username, password }) 57 userAccessToken = await server.loginCommand.getAccessToken({ username, password })
59 58
60 { 59 {
61 const res = await getMyUserInformation(server.url, server.accessToken) 60 const res = await getMyUserInformation(server.url, server.accessToken)
@@ -286,7 +285,7 @@ describe('Test videos API validator', function () {
286 } 285 }
287 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 286 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
288 287
289 const accessTokenUser = await userLogin(server, user) 288 const accessTokenUser = await server.loginCommand.getAccessToken(user)
290 const res = await getMyUserInformation(server.url, accessTokenUser) 289 const res = await getMyUserInformation(server.url, accessTokenUser)
291 const customChannelId = res.body.videoChannels[0].id 290 const customChannelId = res.body.videoChannels[0].id
292 291