unblockUser,
uploadVideo,
userLogin,
- verifyEmail
-} from '../../utils'
-import { flushTests, killallServers, ServerInfo, setAccessTokensToServers } from '../../utils/index'
-import { mockSmtpServer } from '../../utils/miscs/email'
-import { waitJobs } from '../../utils/server/jobs'
+ verifyEmail,
+ flushTests,
+ killallServers,
+ ServerInfo,
+ setAccessTokensToServers
+} from '../../../../shared/utils'
+import { MockSmtpServer } from '../../../../shared/utils/miscs/email'
+import { waitJobs } from '../../../../shared/utils/server/jobs'
const expect = chai.expect
before(async function () {
this.timeout(30000)
- await mockSmtpServer(emails)
+ await MockSmtpServer.Instance.collectEmails(emails)
await flushTests()
const email = emails[0]
+ expect(email['from'][0]['name']).equal('localhost:9001')
expect(email['from'][0]['address']).equal('test-admin@localhost')
expect(email['to'][0]['address']).equal('user_1@example.com')
expect(email['subject']).contains('password')
const email = emails[1]
+ expect(email['from'][0]['name']).equal('localhost:9001')
expect(email['from'][0]['address']).equal('test-admin@localhost')
expect(email['to'][0]['address']).equal('admin1@example.com')
expect(email['subject']).contains('abuse')
})
})
- describe('When blocking/unblocking user', async function () {
+ describe('When blocking/unblocking user', function () {
+
it('Should send the notification email when blocking a user', async function () {
this.timeout(10000)
const email = emails[2]
+ expect(email['from'][0]['name']).equal('localhost:9001')
expect(email['from'][0]['address']).equal('test-admin@localhost')
expect(email['to'][0]['address']).equal('user_1@example.com')
expect(email['subject']).contains(' blocked')
const email = emails[3]
+ expect(email['from'][0]['name']).equal('localhost:9001')
expect(email['from'][0]['address']).equal('test-admin@localhost')
expect(email['to'][0]['address']).equal('user_1@example.com')
expect(email['subject']).contains(' unblocked')
const email = emails[4]
+ expect(email['from'][0]['name']).equal('localhost:9001')
expect(email['from'][0]['address']).equal('test-admin@localhost')
expect(email['to'][0]['address']).equal('user_1@example.com')
expect(email['subject']).contains(' blacklisted')
const email = emails[5]
+ expect(email['from'][0]['name']).equal('localhost:9001')
expect(email['from'][0]['address']).equal('test-admin@localhost')
expect(email['to'][0]['address']).equal('user_1@example.com')
expect(email['subject']).contains(' unblacklisted')
const email = emails[6]
+ expect(email['from'][0]['name']).equal('localhost:9001')
expect(email['from'][0]['address']).equal('test-admin@localhost')
expect(email['to'][0]['address']).equal('user_1@example.com')
expect(email['subject']).contains('Verify')
})
after(async function () {
+ MockSmtpServer.Instance.kill()
killallServers([ server ])
})
})