aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-07 11:51:09 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:17 +0200
commit65e6e2602c0d5521f3a6740f7469bb92830ecb53 (patch)
treef89024ffff1dafb0281ee2fe028e89b95101bd44 /server/tests/api/users
parentbc8090411ddaa8d742ce4de3c83f9dba7bc18e2a (diff)
downloadPeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.tar.gz
PeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.tar.zst
PeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.zip
Introduce config command
Diffstat (limited to 'server/tests/api/users')
-rw-r--r--server/tests/api/users/users-verification.ts37
-rw-r--r--server/tests/api/users/users.ts9
2 files changed, 24 insertions, 22 deletions
diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts
index 265cd6050..23f81d804 100644
--- a/server/tests/api/users/users-verification.ts
+++ b/server/tests/api/users/users-verification.ts
@@ -11,7 +11,6 @@ import {
11 login, 11 login,
12 registerUser, 12 registerUser,
13 ServerInfo, 13 ServerInfo,
14 updateCustomSubConfig,
15 updateMyUser, 14 updateMyUser,
16 userLogin, 15 userLogin,
17 verifyEmail 16 verifyEmail
@@ -58,11 +57,13 @@ describe('Test users account verification', function () {
58 it('Should register user and send verification email if verification required', async function () { 57 it('Should register user and send verification email if verification required', async function () {
59 this.timeout(30000) 58 this.timeout(30000)
60 59
61 await updateCustomSubConfig(server.url, server.accessToken, { 60 await server.configCommand.updateCustomSubConfig({
62 signup: { 61 newConfig: {
63 enabled: true, 62 signup: {
64 requiresEmailVerification: true, 63 enabled: true,
65 limit: 10 64 requiresEmailVerification: true,
65 limit: 10
66 }
66 } 67 }
67 }) 68 })
68 69
@@ -148,11 +149,13 @@ describe('Test users account verification', function () {
148 149
149 it('Should register user not requiring email verification if setting not enabled', async function () { 150 it('Should register user not requiring email verification if setting not enabled', async function () {
150 this.timeout(5000) 151 this.timeout(5000)
151 await updateCustomSubConfig(server.url, server.accessToken, { 152 await server.configCommand.updateCustomSubConfig({
152 signup: { 153 newConfig: {
153 enabled: true, 154 signup: {
154 requiresEmailVerification: false, 155 enabled: true,
155 limit: 10 156 requiresEmailVerification: false,
157 limit: 10
158 }
156 } 159 }
157 }) 160 })
158 161
@@ -168,11 +171,13 @@ describe('Test users account verification', function () {
168 }) 171 })
169 172
170 it('Should allow login for user with unverified email when setting later enabled', async function () { 173 it('Should allow login for user with unverified email when setting later enabled', async function () {
171 await updateCustomSubConfig(server.url, server.accessToken, { 174 await server.configCommand.updateCustomSubConfig({
172 signup: { 175 newConfig: {
173 enabled: true, 176 signup: {
174 requiresEmailVerification: true, 177 enabled: true,
175 limit: 10 178 requiresEmailVerification: true,
179 limit: 10
180 }
176 } 181 }
177 }) 182 })
178 183
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index ba4183e08..33bcc8701 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -13,7 +13,6 @@ import {
13 flushAndRunServer, 13 flushAndRunServer,
14 getAccountRatings, 14 getAccountRatings,
15 getBlacklistedVideosList, 15 getBlacklistedVideosList,
16 getCustomConfig,
17 getMyUserInformation, 16 getMyUserInformation,
18 getMyUserVideoQuotaUsed, 17 getMyUserVideoQuotaUsed,
19 getMyUserVideoRating, 18 getMyUserVideoRating,
@@ -38,7 +37,6 @@ import {
38 setTokenField, 37 setTokenField,
39 testImage, 38 testImage,
40 unblockUser, 39 unblockUser,
41 updateCustomSubConfig,
42 updateMyAvatar, 40 updateMyAvatar,
43 updateMyUser, 41 updateMyUser,
44 updateUser, 42 updateUser,
@@ -46,7 +44,7 @@ import {
46 userLogin, 44 userLogin,
47 waitJobs 45 waitJobs
48} from '@shared/extra-utils' 46} from '@shared/extra-utils'
49import { AbuseState, CustomConfig, MyUser, OAuth2ErrorCode, User, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models' 47import { AbuseState, MyUser, OAuth2ErrorCode, User, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models'
50 48
51const expect = chai.expect 49const expect = chai.expect
52 50
@@ -418,12 +416,11 @@ describe('Test users', function () {
418 this.timeout(60000) 416 this.timeout(60000)
419 417
420 { 418 {
421 const res = await getCustomConfig(server.url, server.accessToken) 419 const config = await server.configCommand.getCustomConfig()
422 const config = res.body as CustomConfig
423 config.transcoding.webtorrent.enabled = false 420 config.transcoding.webtorrent.enabled = false
424 config.transcoding.hls.enabled = true 421 config.transcoding.hls.enabled = true
425 config.transcoding.enabled = true 422 config.transcoding.enabled = true
426 await updateCustomSubConfig(server.url, server.accessToken, config) 423 await server.configCommand.updateCustomSubConfig({ newConfig: config })
427 } 424 }
428 425
429 { 426 {