]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/server/email.ts
Deprecate old static routes
[github/Chocobozzz/PeerTube.git] / server / tests / api / server / email.ts
index 95b64a45959fd3a95333e15af4b0618619524318..05c89d2a38b69b4a891f0c136da978df7e738ae4 100644 (file)
@@ -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)