diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-08 17:36:10 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-08 17:44:22 +0200 |
commit | eacb25c4366bcc8fba20f98f93f004fabc6d5578 (patch) | |
tree | d006c6ef3358ec8c3e3deda643dc9b70068f2515 /server/tests/api | |
parent | a6ce68673ace5b94a81eda3ba198f0a4170eb05e (diff) | |
download | PeerTube-eacb25c4366bcc8fba20f98f93f004fabc6d5578.tar.gz PeerTube-eacb25c4366bcc8fba20f98f93f004fabc6d5578.tar.zst PeerTube-eacb25c4366bcc8fba20f98f93f004fabc6d5578.zip |
Add reason when banning a user
Diffstat (limited to 'server/tests/api')
-rw-r--r-- | server/tests/api/server/email.ts | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts index 4be013c84..65d6a759f 100644 --- a/server/tests/api/server/email.ts +++ b/server/tests/api/server/email.ts | |||
@@ -2,7 +2,17 @@ | |||
2 | 2 | ||
3 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
4 | import 'mocha' | 4 | import 'mocha' |
5 | import { askResetPassword, createUser, reportVideoAbuse, resetPassword, runServer, uploadVideo, userLogin, wait } from '../../utils' | 5 | import { |
6 | askResetPassword, | ||
7 | blockUser, | ||
8 | createUser, | ||
9 | reportVideoAbuse, | ||
10 | resetPassword, | ||
11 | runServer, | ||
12 | unblockUser, | ||
13 | uploadVideo, | ||
14 | userLogin | ||
15 | } from '../../utils' | ||
6 | import { flushTests, killallServers, ServerInfo, setAccessTokensToServers } from '../../utils/index' | 16 | import { flushTests, killallServers, ServerInfo, setAccessTokensToServers } from '../../utils/index' |
7 | import { mockSmtpServer } from '../../utils/miscs/email' | 17 | import { mockSmtpServer } from '../../utils/miscs/email' |
8 | import { waitJobs } from '../../utils/server/jobs' | 18 | import { waitJobs } from '../../utils/server/jobs' |
@@ -112,6 +122,42 @@ describe('Test emails', function () { | |||
112 | }) | 122 | }) |
113 | }) | 123 | }) |
114 | 124 | ||
125 | describe('When blocking/unblocking user', async function () { | ||
126 | it('Should send the notification email when blocking a user', async function () { | ||
127 | this.timeout(10000) | ||
128 | |||
129 | const reason = 'my super bad reason' | ||
130 | await blockUser(server.url, userId, server.accessToken, 204, reason) | ||
131 | |||
132 | await waitJobs(server) | ||
133 | expect(emails).to.have.lengthOf(3) | ||
134 | |||
135 | const email = emails[2] | ||
136 | |||
137 | expect(email['from'][0]['address']).equal('test-admin@localhost') | ||
138 | expect(email['to'][0]['address']).equal('user_1@example.com') | ||
139 | expect(email['subject']).contains(' blocked') | ||
140 | expect(email['text']).contains(' blocked') | ||
141 | expect(email['text']).contains(reason) | ||
142 | }) | ||
143 | |||
144 | it('Should send the notification email when unblocking a user', async function () { | ||
145 | this.timeout(10000) | ||
146 | |||
147 | await unblockUser(server.url, userId, server.accessToken, 204) | ||
148 | |||
149 | await waitJobs(server) | ||
150 | expect(emails).to.have.lengthOf(4) | ||
151 | |||
152 | const email = emails[3] | ||
153 | |||
154 | expect(email['from'][0]['address']).equal('test-admin@localhost') | ||
155 | expect(email['to'][0]['address']).equal('user_1@example.com') | ||
156 | expect(email['subject']).contains(' unblocked') | ||
157 | expect(email['text']).contains(' unblocked') | ||
158 | }) | ||
159 | }) | ||
160 | |||
115 | after(async function () { | 161 | after(async function () { |
116 | killallServers([ server ]) | 162 | killallServers([ server ]) |
117 | }) | 163 | }) |