diff options
Diffstat (limited to 'server/tests/api/users/users-verification.ts')
-rw-r--r-- | server/tests/api/users/users-verification.ts | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts index 271aa3c7a..c8c226fa8 100644 --- a/server/tests/api/users/users-verification.ts +++ b/server/tests/api/users/users-verification.ts | |||
@@ -42,7 +42,7 @@ describe('Test users account verification', function () { | |||
42 | it('Should register user and send verification email if verification required', async function () { | 42 | it('Should register user and send verification email if verification required', async function () { |
43 | this.timeout(30000) | 43 | this.timeout(30000) |
44 | 44 | ||
45 | await server.configCommand.updateCustomSubConfig({ | 45 | await server.config.updateCustomSubConfig({ |
46 | newConfig: { | 46 | newConfig: { |
47 | signup: { | 47 | signup: { |
48 | enabled: true, | 48 | enabled: true, |
@@ -52,7 +52,7 @@ describe('Test users account verification', function () { | |||
52 | } | 52 | } |
53 | }) | 53 | }) |
54 | 54 | ||
55 | await server.usersCommand.register(user1) | 55 | await server.users.register(user1) |
56 | 56 | ||
57 | await waitJobs(server) | 57 | await waitJobs(server) |
58 | expectedEmailsLength++ | 58 | expectedEmailsLength++ |
@@ -71,22 +71,22 @@ describe('Test users account verification', function () { | |||
71 | 71 | ||
72 | userId = parseInt(userIdMatches[1], 10) | 72 | userId = parseInt(userIdMatches[1], 10) |
73 | 73 | ||
74 | const body = await server.usersCommand.get({ userId }) | 74 | const body = await server.users.get({ userId }) |
75 | expect(body.emailVerified).to.be.false | 75 | expect(body.emailVerified).to.be.false |
76 | }) | 76 | }) |
77 | 77 | ||
78 | it('Should not allow login for user with unverified email', async function () { | 78 | it('Should not allow login for user with unverified email', async function () { |
79 | const { detail } = await server.loginCommand.login({ user: user1, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 79 | const { detail } = await server.login.login({ user: user1, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
80 | expect(detail).to.contain('User email is not verified.') | 80 | expect(detail).to.contain('User email is not verified.') |
81 | }) | 81 | }) |
82 | 82 | ||
83 | it('Should verify the user via email and allow login', async function () { | 83 | it('Should verify the user via email and allow login', async function () { |
84 | await server.usersCommand.verifyEmail({ userId, verificationString }) | 84 | await server.users.verifyEmail({ userId, verificationString }) |
85 | 85 | ||
86 | const body = await server.loginCommand.login({ user: user1 }) | 86 | const body = await server.login.login({ user: user1 }) |
87 | userAccessToken = body.access_token | 87 | userAccessToken = body.access_token |
88 | 88 | ||
89 | const user = await server.usersCommand.get({ userId }) | 89 | const user = await server.users.get({ userId }) |
90 | expect(user.emailVerified).to.be.true | 90 | expect(user.emailVerified).to.be.true |
91 | }) | 91 | }) |
92 | 92 | ||
@@ -96,7 +96,7 @@ describe('Test users account verification', function () { | |||
96 | let updateVerificationString: string | 96 | let updateVerificationString: string |
97 | 97 | ||
98 | { | 98 | { |
99 | await server.usersCommand.updateMe({ | 99 | await server.users.updateMe({ |
100 | token: userAccessToken, | 100 | token: userAccessToken, |
101 | email: 'updated@example.com', | 101 | email: 'updated@example.com', |
102 | currentPassword: user1.password | 102 | currentPassword: user1.password |
@@ -113,15 +113,15 @@ describe('Test users account verification', function () { | |||
113 | } | 113 | } |
114 | 114 | ||
115 | { | 115 | { |
116 | const me = await server.usersCommand.getMyInfo({ token: userAccessToken }) | 116 | const me = await server.users.getMyInfo({ token: userAccessToken }) |
117 | expect(me.email).to.equal('user_1@example.com') | 117 | expect(me.email).to.equal('user_1@example.com') |
118 | expect(me.pendingEmail).to.equal('updated@example.com') | 118 | expect(me.pendingEmail).to.equal('updated@example.com') |
119 | } | 119 | } |
120 | 120 | ||
121 | { | 121 | { |
122 | await server.usersCommand.verifyEmail({ userId, verificationString: updateVerificationString, isPendingEmail: true }) | 122 | await server.users.verifyEmail({ userId, verificationString: updateVerificationString, isPendingEmail: true }) |
123 | 123 | ||
124 | const me = await server.usersCommand.getMyInfo({ token: userAccessToken }) | 124 | const me = await server.users.getMyInfo({ token: userAccessToken }) |
125 | expect(me.email).to.equal('updated@example.com') | 125 | expect(me.email).to.equal('updated@example.com') |
126 | expect(me.pendingEmail).to.be.null | 126 | expect(me.pendingEmail).to.be.null |
127 | } | 127 | } |
@@ -129,7 +129,7 @@ describe('Test users account verification', function () { | |||
129 | 129 | ||
130 | it('Should register user not requiring email verification if setting not enabled', async function () { | 130 | it('Should register user not requiring email verification if setting not enabled', async function () { |
131 | this.timeout(5000) | 131 | this.timeout(5000) |
132 | await server.configCommand.updateCustomSubConfig({ | 132 | await server.config.updateCustomSubConfig({ |
133 | newConfig: { | 133 | newConfig: { |
134 | signup: { | 134 | signup: { |
135 | enabled: true, | 135 | enabled: true, |
@@ -139,19 +139,19 @@ describe('Test users account verification', function () { | |||
139 | } | 139 | } |
140 | }) | 140 | }) |
141 | 141 | ||
142 | await server.usersCommand.register(user2) | 142 | await server.users.register(user2) |
143 | 143 | ||
144 | await waitJobs(server) | 144 | await waitJobs(server) |
145 | expect(emails).to.have.lengthOf(expectedEmailsLength) | 145 | expect(emails).to.have.lengthOf(expectedEmailsLength) |
146 | 146 | ||
147 | const accessToken = await server.loginCommand.getAccessToken(user2) | 147 | const accessToken = await server.login.getAccessToken(user2) |
148 | 148 | ||
149 | const user = await server.usersCommand.getMyInfo({ token: accessToken }) | 149 | const user = await server.users.getMyInfo({ token: accessToken }) |
150 | expect(user.emailVerified).to.be.null | 150 | expect(user.emailVerified).to.be.null |
151 | }) | 151 | }) |
152 | 152 | ||
153 | it('Should allow login for user with unverified email when setting later enabled', async function () { | 153 | it('Should allow login for user with unverified email when setting later enabled', async function () { |
154 | await server.configCommand.updateCustomSubConfig({ | 154 | await server.config.updateCustomSubConfig({ |
155 | newConfig: { | 155 | newConfig: { |
156 | signup: { | 156 | signup: { |
157 | enabled: true, | 157 | enabled: true, |
@@ -161,7 +161,7 @@ describe('Test users account verification', function () { | |||
161 | } | 161 | } |
162 | }) | 162 | }) |
163 | 163 | ||
164 | await server.loginCommand.getAccessToken(user2) | 164 | await server.login.getAccessToken(user2) |
165 | }) | 165 | }) |
166 | 166 | ||
167 | after(async function () { | 167 | after(async function () { |