X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fserver%2Femail.ts;h=cd8d703411c21de44bcbbfda5ecec35a91fb573e;hb=0fbc0dec59684527fad8772080a8e1f928c07ea1;hp=b202cf8a7bb7817044b4d9826976f6dab6961bc1;hpb=254d3579f5338f5fd775c17d15cdfc37078bcfb4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts index b202cf8a7..cd8d70341 100644 --- a/server/tests/api/server/email.ts +++ b/server/tests/api/server/email.ts @@ -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) }) })