]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/server/email.ts
Fix tests
[github/Chocobozzz/PeerTube.git] / server / tests / api / server / email.ts
index b202cf8a7bb7817044b4d9826976f6dab6961bc1..cd8d703411c21de44bcbbfda5ecec35a91fb573e 100644 (file)
@@ -2,8 +2,8 @@
 
 import 'mocha'
 import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/core-utils'
 import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
+import { HttpStatusCode } from '@shared/models'
 
 const expect = chai.expect
 
@@ -13,7 +13,7 @@ describe('Test emails', function () {
   let userId2: number
   let userAccessToken: string
 
-  let videoUUID: string
+  let videoShortUUID: string
   let videoId: number
 
   let videoUserUUID: string
@@ -59,8 +59,8 @@ describe('Test emails', function () {
       const attributes = {
         name: 'my super name'
       }
-      const { uuid, id } = await server.videos.upload({ attributes })
-      videoUUID = uuid
+      const { shortUUID, id } = await server.videos.upload({ attributes })
+      videoShortUUID = shortUUID
       videoId = id
     }
   })
@@ -180,11 +180,12 @@ describe('Test emails', 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 server.abuses.report({ videoId, reason })
+      await server.abuses.report({ token: userAccessToken, videoId, reason })
 
       await waitJobs(server)
       expect(emails).to.have.lengthOf(3)
@@ -195,7 +196,7 @@ describe('Test emails', function () {
       expect(email['from'][0]['address']).equal('test-admin@localhost')
       expect(email['to'][0]['address']).equal('admin' + server.internalServerNumber + '@example.com')
       expect(email['subject']).contains('abuse')
-      expect(email['text']).contains(videoUUID)
+      expect(email['text']).contains(videoShortUUID)
     })
   })