X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fserver%2Femail.ts;h=05c89d2a38b69b4a891f0c136da978df7e738ae4;hb=20dcfd74982f4ec8a143696abed02b059d30d9ec;hp=95b64a45959fd3a95333e15af4b0618619524318;hpb=c2777c1dfe688c8fab1ef2fed50e360100fa9198;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts index 95b64a459..05c89d2a3 100644 --- a/server/tests/api/server/email.ts +++ b/server/tests/api/server/email.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import * as chai from 'chai' import 'mocha' +import * as chai from 'chai' import { addVideoToBlacklist, askResetPassword, @@ -11,7 +11,7 @@ import { createUser, flushAndRunServer, removeVideoFromBlacklist, - reportVideoAbuse, + reportAbuse, resetPassword, ServerInfo, setAccessTokensToServers, @@ -30,10 +30,15 @@ describe('Test emails', function () { let userId: number let userId2: number let userAccessToken: string + let videoUUID: string + let videoId: number + let videoUserUUID: string + let verificationString: string let verificationString2: string + const emails: object[] = [] const user = { username: 'user_1', @@ -76,6 +81,7 @@ describe('Test emails', function () { } const res = await uploadVideo(server.url, server.accessToken, attributes) videoUUID = res.body.video.uuid + videoId = res.body.video.id } }) @@ -117,6 +123,10 @@ describe('Test emails', function () { await resetPassword(server.url, userId, verificationString, 'super_password2') }) + it('Should not reset the password with the same verification string', async function () { + await resetPassword(server.url, userId, verificationString, 'super_password3', 403) + }) + it('Should login with this new password', async function () { user.password = 'super_password2' @@ -174,12 +184,12 @@ describe('Test emails', function () { }) }) - describe('When creating a video abuse', function () { + describe('When creating an abuse', function () { it('Should send the notification email', async function () { this.timeout(10000) const reason = 'my super bad reason' - await reportVideoAbuse(server.url, server.accessToken, videoUUID, reason) + await reportAbuse({ url: server.url, token: server.accessToken, videoId, reason }) await waitJobs(server) expect(emails).to.have.lengthOf(3)