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
let userId2: number
let userAccessToken: string
- let videoUUID: string
+ let videoShortUUID: string
let videoId: number
let videoUserUUID: string
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
}
})
})
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)
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)
})
})