aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-02-14 13:17:10 +0100
committerChocobozzz <me@florianbigard.com>2019-02-14 13:17:10 +0100
commit98d33a03d3a86aad709e2cd39a4e4d8bac6b7664 (patch)
treed8e1e8d21054fc4d966c009bdd05333a2a6e44cb /server/tests
parent73471b1a52f242e86364ffb077ea6cadb3b07ae2 (diff)
parent340f31ce96c456942fb01800f31d795e0f355d74 (diff)
downloadPeerTube-98d33a03d3a86aad709e2cd39a4e4d8bac6b7664.tar.gz
PeerTube-98d33a03d3a86aad709e2cd39a4e4d8bac6b7664.tar.zst
PeerTube-98d33a03d3a86aad709e2cd39a4e4d8bac6b7664.zip
Merge branch 'release/v1.2.0'
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/server/contact-form.ts3
-rw-r--r--server/tests/api/server/email.ts7
-rw-r--r--server/tests/api/users/user-notifications.ts14
-rw-r--r--server/tests/helpers/comment-model.ts2
4 files changed, 25 insertions, 1 deletions
diff --git a/server/tests/api/server/contact-form.ts b/server/tests/api/server/contact-form.ts
index 93221d0a3..06a2f89b0 100644
--- a/server/tests/api/server/contact-form.ts
+++ b/server/tests/api/server/contact-form.ts
@@ -45,7 +45,8 @@ describe('Test contact form', function () {
45 45
46 const email = emails[0] 46 const email = emails[0]
47 47
48 expect(email['from'][0]['address']).equal('toto@example.com') 48 expect(email['from'][0]['address']).equal('test-admin@localhost')
49 expect(email['from'][0]['name']).equal('toto@example.com')
49 expect(email['to'][0]['address']).equal('admin1@example.com') 50 expect(email['to'][0]['address']).equal('admin1@example.com')
50 expect(email['subject']).contains('Contact form') 51 expect(email['subject']).contains('Contact form')
51 expect(email['text']).contains('my super message') 52 expect(email['text']).contains('my super message')
diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts
index f96c57b66..f8f16f54f 100644
--- a/server/tests/api/server/email.ts
+++ b/server/tests/api/server/email.ts
@@ -89,6 +89,7 @@ describe('Test emails', function () {
89 89
90 const email = emails[0] 90 const email = emails[0]
91 91
92 expect(email['from'][0]['name']).equal('localhost:9001')
92 expect(email['from'][0]['address']).equal('test-admin@localhost') 93 expect(email['from'][0]['address']).equal('test-admin@localhost')
93 expect(email['to'][0]['address']).equal('user_1@example.com') 94 expect(email['to'][0]['address']).equal('user_1@example.com')
94 expect(email['subject']).contains('password') 95 expect(email['subject']).contains('password')
@@ -133,6 +134,7 @@ describe('Test emails', function () {
133 134
134 const email = emails[1] 135 const email = emails[1]
135 136
137 expect(email['from'][0]['name']).equal('localhost:9001')
136 expect(email['from'][0]['address']).equal('test-admin@localhost') 138 expect(email['from'][0]['address']).equal('test-admin@localhost')
137 expect(email['to'][0]['address']).equal('admin1@example.com') 139 expect(email['to'][0]['address']).equal('admin1@example.com')
138 expect(email['subject']).contains('abuse') 140 expect(email['subject']).contains('abuse')
@@ -152,6 +154,7 @@ describe('Test emails', function () {
152 154
153 const email = emails[2] 155 const email = emails[2]
154 156
157 expect(email['from'][0]['name']).equal('localhost:9001')
155 expect(email['from'][0]['address']).equal('test-admin@localhost') 158 expect(email['from'][0]['address']).equal('test-admin@localhost')
156 expect(email['to'][0]['address']).equal('user_1@example.com') 159 expect(email['to'][0]['address']).equal('user_1@example.com')
157 expect(email['subject']).contains(' blocked') 160 expect(email['subject']).contains(' blocked')
@@ -169,6 +172,7 @@ describe('Test emails', function () {
169 172
170 const email = emails[3] 173 const email = emails[3]
171 174
175 expect(email['from'][0]['name']).equal('localhost:9001')
172 expect(email['from'][0]['address']).equal('test-admin@localhost') 176 expect(email['from'][0]['address']).equal('test-admin@localhost')
173 expect(email['to'][0]['address']).equal('user_1@example.com') 177 expect(email['to'][0]['address']).equal('user_1@example.com')
174 expect(email['subject']).contains(' unblocked') 178 expect(email['subject']).contains(' unblocked')
@@ -188,6 +192,7 @@ describe('Test emails', function () {
188 192
189 const email = emails[4] 193 const email = emails[4]
190 194
195 expect(email['from'][0]['name']).equal('localhost:9001')
191 expect(email['from'][0]['address']).equal('test-admin@localhost') 196 expect(email['from'][0]['address']).equal('test-admin@localhost')
192 expect(email['to'][0]['address']).equal('user_1@example.com') 197 expect(email['to'][0]['address']).equal('user_1@example.com')
193 expect(email['subject']).contains(' blacklisted') 198 expect(email['subject']).contains(' blacklisted')
@@ -205,6 +210,7 @@ describe('Test emails', function () {
205 210
206 const email = emails[5] 211 const email = emails[5]
207 212
213 expect(email['from'][0]['name']).equal('localhost:9001')
208 expect(email['from'][0]['address']).equal('test-admin@localhost') 214 expect(email['from'][0]['address']).equal('test-admin@localhost')
209 expect(email['to'][0]['address']).equal('user_1@example.com') 215 expect(email['to'][0]['address']).equal('user_1@example.com')
210 expect(email['subject']).contains(' unblacklisted') 216 expect(email['subject']).contains(' unblacklisted')
@@ -224,6 +230,7 @@ describe('Test emails', function () {
224 230
225 const email = emails[6] 231 const email = emails[6]
226 232
233 expect(email['from'][0]['name']).equal('localhost:9001')
227 expect(email['from'][0]['address']).equal('test-admin@localhost') 234 expect(email['from'][0]['address']).equal('test-admin@localhost')
228 expect(email['to'][0]['address']).equal('user_1@example.com') 235 expect(email['to'][0]['address']).equal('user_1@example.com')
229 expect(email['subject']).contains('Verify') 236 expect(email['subject']).contains('Verify')
diff --git a/server/tests/api/users/user-notifications.ts b/server/tests/api/users/user-notifications.ts
index 5260d64cc..72b6a0aa2 100644
--- a/server/tests/api/users/user-notifications.ts
+++ b/server/tests/api/users/user-notifications.ts
@@ -506,6 +506,20 @@ describe('Test users notifications', function () {
506 await removeAccountFromAccountBlocklist(servers[ 0 ].url, userAccessToken, 'root') 506 await removeAccountFromAccountBlocklist(servers[ 0 ].url, userAccessToken, 'root')
507 }) 507 })
508 508
509 it('Should not send a new mention notification if the remote account mention a local account', async function () {
510 this.timeout(20000)
511
512 const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'super video' })
513 const uuid = resVideo.body.video.uuid
514
515 await waitJobs(servers)
516 const resThread = await addVideoCommentThread(servers[1].url, servers[1].accessToken, uuid, '@user_1 hello')
517 const threadId = resThread.body.comment.id
518
519 await waitJobs(servers)
520 await checkCommentMention(baseParams, uuid, threadId, threadId, 'super root 2 name', 'absence')
521 })
522
509 it('Should send a new mention notification after local comments', async function () { 523 it('Should send a new mention notification after local comments', async function () {
510 this.timeout(10000) 524 this.timeout(10000)
511 525
diff --git a/server/tests/helpers/comment-model.ts b/server/tests/helpers/comment-model.ts
index 76bb0f212..ebfd779e1 100644
--- a/server/tests/helpers/comment-model.ts
+++ b/server/tests/helpers/comment-model.ts
@@ -10,6 +10,8 @@ class CommentMock {
10 text: string 10 text: string
11 11
12 extractMentions = VideoCommentModel.prototype.extractMentions 12 extractMentions = VideoCommentModel.prototype.extractMentions
13
14 isOwned = () => true
13} 15}
14 16
15describe('Comment model', function () { 17describe('Comment model', function () {