diff options
Diffstat (limited to 'server/tests/api/server/email.ts')
-rw-r--r-- | server/tests/api/server/email.ts | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts index aeda5fddb..258e835e7 100644 --- a/server/tests/api/server/email.ts +++ b/server/tests/api/server/email.ts | |||
@@ -43,15 +43,15 @@ describe('Test emails', function () { | |||
43 | await setAccessTokensToServers([ server ]) | 43 | await setAccessTokensToServers([ server ]) |
44 | 44 | ||
45 | { | 45 | { |
46 | const created = await server.usersCommand.create({ username: user.username, password: user.password }) | 46 | const created = await server.users.create({ username: user.username, password: user.password }) |
47 | userId = created.id | 47 | userId = created.id |
48 | 48 | ||
49 | userAccessToken = await server.loginCommand.getAccessToken(user) | 49 | userAccessToken = await server.login.getAccessToken(user) |
50 | } | 50 | } |
51 | 51 | ||
52 | { | 52 | { |
53 | const attributes = { name: 'my super user video' } | 53 | const attributes = { name: 'my super user video' } |
54 | const { uuid } = await server.videosCommand.upload({ token: userAccessToken, attributes }) | 54 | const { uuid } = await server.videos.upload({ token: userAccessToken, attributes }) |
55 | videoUserUUID = uuid | 55 | videoUserUUID = uuid |
56 | } | 56 | } |
57 | 57 | ||
@@ -59,7 +59,7 @@ describe('Test emails', function () { | |||
59 | const attributes = { | 59 | const attributes = { |
60 | name: 'my super name' | 60 | name: 'my super name' |
61 | } | 61 | } |
62 | const { uuid, id } = await server.videosCommand.upload({ attributes }) | 62 | const { uuid, id } = await server.videos.upload({ attributes }) |
63 | videoUUID = uuid | 63 | videoUUID = uuid |
64 | videoId = id | 64 | videoId = id |
65 | } | 65 | } |
@@ -70,7 +70,7 @@ describe('Test emails', function () { | |||
70 | it('Should ask to reset the password', async function () { | 70 | it('Should ask to reset the password', async function () { |
71 | this.timeout(10000) | 71 | this.timeout(10000) |
72 | 72 | ||
73 | await server.usersCommand.askResetPassword({ email: 'user_1@example.com' }) | 73 | await server.users.askResetPassword({ email: 'user_1@example.com' }) |
74 | 74 | ||
75 | await waitJobs(server) | 75 | await waitJobs(server) |
76 | expect(emails).to.have.lengthOf(1) | 76 | expect(emails).to.have.lengthOf(1) |
@@ -96,7 +96,7 @@ describe('Test emails', function () { | |||
96 | }) | 96 | }) |
97 | 97 | ||
98 | it('Should not reset the password with an invalid verification string', async function () { | 98 | it('Should not reset the password with an invalid verification string', async function () { |
99 | await server.usersCommand.resetPassword({ | 99 | await server.users.resetPassword({ |
100 | userId, | 100 | userId, |
101 | verificationString: verificationString + 'b', | 101 | verificationString: verificationString + 'b', |
102 | password: 'super_password2', | 102 | password: 'super_password2', |
@@ -105,11 +105,11 @@ describe('Test emails', function () { | |||
105 | }) | 105 | }) |
106 | 106 | ||
107 | it('Should reset the password', async function () { | 107 | it('Should reset the password', async function () { |
108 | await server.usersCommand.resetPassword({ userId, verificationString, password: 'super_password2' }) | 108 | await server.users.resetPassword({ userId, verificationString, password: 'super_password2' }) |
109 | }) | 109 | }) |
110 | 110 | ||
111 | it('Should not reset the password with the same verification string', async function () { | 111 | it('Should not reset the password with the same verification string', async function () { |
112 | await server.usersCommand.resetPassword({ | 112 | await server.users.resetPassword({ |
113 | userId, | 113 | userId, |
114 | verificationString, | 114 | verificationString, |
115 | password: 'super_password3', | 115 | password: 'super_password3', |
@@ -120,7 +120,7 @@ describe('Test emails', function () { | |||
120 | it('Should login with this new password', async function () { | 120 | it('Should login with this new password', async function () { |
121 | user.password = 'super_password2' | 121 | user.password = 'super_password2' |
122 | 122 | ||
123 | await server.loginCommand.getAccessToken(user) | 123 | await server.login.getAccessToken(user) |
124 | }) | 124 | }) |
125 | }) | 125 | }) |
126 | 126 | ||
@@ -129,7 +129,7 @@ describe('Test emails', function () { | |||
129 | it('Should send a create password email', async function () { | 129 | it('Should send a create password email', async function () { |
130 | this.timeout(10000) | 130 | this.timeout(10000) |
131 | 131 | ||
132 | await server.usersCommand.create({ username: 'create_password', password: '' }) | 132 | await server.users.create({ username: 'create_password', password: '' }) |
133 | 133 | ||
134 | await waitJobs(server) | 134 | await waitJobs(server) |
135 | expect(emails).to.have.lengthOf(2) | 135 | expect(emails).to.have.lengthOf(2) |
@@ -155,7 +155,7 @@ describe('Test emails', function () { | |||
155 | }) | 155 | }) |
156 | 156 | ||
157 | it('Should not reset the password with an invalid verification string', async function () { | 157 | it('Should not reset the password with an invalid verification string', async function () { |
158 | await server.usersCommand.resetPassword({ | 158 | await server.users.resetPassword({ |
159 | userId: userId2, | 159 | userId: userId2, |
160 | verificationString: verificationString2 + 'c', | 160 | verificationString: verificationString2 + 'c', |
161 | password: 'newly_created_password', | 161 | password: 'newly_created_password', |
@@ -164,7 +164,7 @@ describe('Test emails', function () { | |||
164 | }) | 164 | }) |
165 | 165 | ||
166 | it('Should reset the password', async function () { | 166 | it('Should reset the password', async function () { |
167 | await server.usersCommand.resetPassword({ | 167 | await server.users.resetPassword({ |
168 | userId: userId2, | 168 | userId: userId2, |
169 | verificationString: verificationString2, | 169 | verificationString: verificationString2, |
170 | password: 'newly_created_password' | 170 | password: 'newly_created_password' |
@@ -172,7 +172,7 @@ describe('Test emails', function () { | |||
172 | }) | 172 | }) |
173 | 173 | ||
174 | it('Should login with this new password', async function () { | 174 | it('Should login with this new password', async function () { |
175 | await server.loginCommand.getAccessToken({ | 175 | await server.login.getAccessToken({ |
176 | username: 'create_password', | 176 | username: 'create_password', |
177 | password: 'newly_created_password' | 177 | password: 'newly_created_password' |
178 | }) | 178 | }) |
@@ -184,7 +184,7 @@ describe('Test emails', function () { | |||
184 | this.timeout(10000) | 184 | this.timeout(10000) |
185 | 185 | ||
186 | const reason = 'my super bad reason' | 186 | const reason = 'my super bad reason' |
187 | await server.abusesCommand.report({ videoId, reason }) | 187 | await server.abuses.report({ videoId, reason }) |
188 | 188 | ||
189 | await waitJobs(server) | 189 | await waitJobs(server) |
190 | expect(emails).to.have.lengthOf(3) | 190 | expect(emails).to.have.lengthOf(3) |
@@ -205,7 +205,7 @@ describe('Test emails', function () { | |||
205 | this.timeout(10000) | 205 | this.timeout(10000) |
206 | 206 | ||
207 | const reason = 'my super bad reason' | 207 | const reason = 'my super bad reason' |
208 | await server.usersCommand.banUser({ userId, reason }) | 208 | await server.users.banUser({ userId, reason }) |
209 | 209 | ||
210 | await waitJobs(server) | 210 | await waitJobs(server) |
211 | expect(emails).to.have.lengthOf(4) | 211 | expect(emails).to.have.lengthOf(4) |
@@ -223,7 +223,7 @@ describe('Test emails', function () { | |||
223 | it('Should send the notification email when unblocking a user', async function () { | 223 | it('Should send the notification email when unblocking a user', async function () { |
224 | this.timeout(10000) | 224 | this.timeout(10000) |
225 | 225 | ||
226 | await server.usersCommand.unbanUser({ userId }) | 226 | await server.users.unbanUser({ userId }) |
227 | 227 | ||
228 | await waitJobs(server) | 228 | await waitJobs(server) |
229 | expect(emails).to.have.lengthOf(5) | 229 | expect(emails).to.have.lengthOf(5) |
@@ -243,7 +243,7 @@ describe('Test emails', function () { | |||
243 | this.timeout(10000) | 243 | this.timeout(10000) |
244 | 244 | ||
245 | const reason = 'my super reason' | 245 | const reason = 'my super reason' |
246 | await server.blacklistCommand.add({ videoId: videoUserUUID, reason }) | 246 | await server.blacklist.add({ videoId: videoUserUUID, reason }) |
247 | 247 | ||
248 | await waitJobs(server) | 248 | await waitJobs(server) |
249 | expect(emails).to.have.lengthOf(6) | 249 | expect(emails).to.have.lengthOf(6) |
@@ -261,7 +261,7 @@ describe('Test emails', function () { | |||
261 | it('Should send the notification email', async function () { | 261 | it('Should send the notification email', async function () { |
262 | this.timeout(10000) | 262 | this.timeout(10000) |
263 | 263 | ||
264 | await server.blacklistCommand.remove({ videoId: videoUserUUID }) | 264 | await server.blacklist.remove({ videoId: videoUserUUID }) |
265 | 265 | ||
266 | await waitJobs(server) | 266 | await waitJobs(server) |
267 | expect(emails).to.have.lengthOf(7) | 267 | expect(emails).to.have.lengthOf(7) |
@@ -286,7 +286,7 @@ describe('Test emails', function () { | |||
286 | it('Should ask to send the verification email', async function () { | 286 | it('Should ask to send the verification email', async function () { |
287 | this.timeout(10000) | 287 | this.timeout(10000) |
288 | 288 | ||
289 | await server.usersCommand.askSendVerifyEmail({ email: 'user_1@example.com' }) | 289 | await server.users.askSendVerifyEmail({ email: 'user_1@example.com' }) |
290 | 290 | ||
291 | await waitJobs(server) | 291 | await waitJobs(server) |
292 | expect(emails).to.have.lengthOf(8) | 292 | expect(emails).to.have.lengthOf(8) |
@@ -312,7 +312,7 @@ describe('Test emails', function () { | |||
312 | }) | 312 | }) |
313 | 313 | ||
314 | it('Should not verify the email with an invalid verification string', async function () { | 314 | it('Should not verify the email with an invalid verification string', async function () { |
315 | await server.usersCommand.verifyEmail({ | 315 | await server.users.verifyEmail({ |
316 | userId, | 316 | userId, |
317 | verificationString: verificationString + 'b', | 317 | verificationString: verificationString + 'b', |
318 | isPendingEmail: false, | 318 | isPendingEmail: false, |
@@ -321,7 +321,7 @@ describe('Test emails', function () { | |||
321 | }) | 321 | }) |
322 | 322 | ||
323 | it('Should verify the email', async function () { | 323 | it('Should verify the email', async function () { |
324 | await server.usersCommand.verifyEmail({ userId, verificationString }) | 324 | await server.users.verifyEmail({ userId, verificationString }) |
325 | }) | 325 | }) |
326 | }) | 326 | }) |
327 | 327 | ||