X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fserver%2Femail.ts;h=20b5e378c985e4669f3ecd9912ba639a36fe3bea;hb=c795e19663a93c24908a7318975f820bac63164f;hp=4c5b296ee549186044d36d9281749d81fee8fa79;hpb=c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts index 4c5b296ee..20b5e378c 100644 --- a/server/tests/api/server/email.ts +++ b/server/tests/api/server/email.ts @@ -2,8 +2,9 @@ import 'mocha' import * as chai from 'chai' +import { MockSmtpServer } from '@server/tests/shared' import { HttpStatusCode } from '@shared/models' -import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' +import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' const expect = chai.expect @@ -13,7 +14,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 +60,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 +181,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 +197,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) }) })