aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/check-params/blocklist.ts72
-rw-r--r--server/tests/api/check-params/config.ts12
-rw-r--r--server/tests/api/check-params/plugins.ts2
-rw-r--r--server/tests/api/moderation/blocklist.ts107
-rw-r--r--server/tests/api/notifications/moderation-notifications.ts84
-rw-r--r--server/tests/api/notifications/user-notifications.ts2
-rw-r--r--server/tests/api/redundancy/redundancy.ts16
-rw-r--r--server/tests/api/server/config.ts18
-rw-r--r--server/tests/api/server/email.ts2
-rw-r--r--server/tests/api/videos/video-privacy.ts13
10 files changed, 281 insertions, 47 deletions
diff --git a/server/tests/api/check-params/blocklist.ts b/server/tests/api/check-params/blocklist.ts
index 7d5fae5cf..f72a892e2 100644
--- a/server/tests/api/check-params/blocklist.ts
+++ b/server/tests/api/check-params/blocklist.ts
@@ -481,6 +481,78 @@ describe('Test blocklist API validators', function () {
481 }) 481 })
482 }) 482 })
483 483
484 describe('When getting blocklist status', function () {
485 const path = '/api/v1/blocklist/status'
486
487 it('Should fail with a bad token', async function () {
488 await makeGetRequest({
489 url: server.url,
490 path,
491 token: 'false',
492 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
493 })
494 })
495
496 it('Should fail with a bad accounts field', async function () {
497 await makeGetRequest({
498 url: server.url,
499 path,
500 query: {
501 accounts: 1
502 },
503 expectedStatus: HttpStatusCode.BAD_REQUEST_400
504 })
505
506 await makeGetRequest({
507 url: server.url,
508 path,
509 query: {
510 accounts: [ 1 ]
511 },
512 expectedStatus: HttpStatusCode.BAD_REQUEST_400
513 })
514 })
515
516 it('Should fail with a bad hosts field', async function () {
517 await makeGetRequest({
518 url: server.url,
519 path,
520 query: {
521 hosts: 1
522 },
523 expectedStatus: HttpStatusCode.BAD_REQUEST_400
524 })
525
526 await makeGetRequest({
527 url: server.url,
528 path,
529 query: {
530 hosts: [ 1 ]
531 },
532 expectedStatus: HttpStatusCode.BAD_REQUEST_400
533 })
534 })
535
536 it('Should succeed with the correct parameters', async function () {
537 await makeGetRequest({
538 url: server.url,
539 path,
540 query: {},
541 expectedStatus: HttpStatusCode.OK_200
542 })
543
544 await makeGetRequest({
545 url: server.url,
546 path,
547 query: {
548 hosts: [ 'example.com' ],
549 accounts: [ 'john@example.com' ]
550 },
551 expectedStatus: HttpStatusCode.OK_200
552 })
553 })
554 })
555
484 after(async function () { 556 after(async function () {
485 await cleanupTests(servers) 557 await cleanupTests(servers)
486 }) 558 })
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts
index d0cd7722b..a6e87730a 100644
--- a/server/tests/api/check-params/config.ts
+++ b/server/tests/api/check-params/config.ts
@@ -54,6 +54,18 @@ describe('Test config API validators', function () {
54 whitelisted: true 54 whitelisted: true
55 } 55 }
56 }, 56 },
57 client: {
58 videos: {
59 miniature: {
60 preferAuthorDisplayName: false
61 }
62 },
63 menu: {
64 login: {
65 redirectOnSingleExternalAuth: false
66 }
67 }
68 },
57 cache: { 69 cache: {
58 previews: { 70 previews: {
59 size: 2 71 size: 2
diff --git a/server/tests/api/check-params/plugins.ts b/server/tests/api/check-params/plugins.ts
index 33f84ecbc..2c436376c 100644
--- a/server/tests/api/check-params/plugins.ts
+++ b/server/tests/api/check-params/plugins.ts
@@ -30,7 +30,7 @@ describe('Test server plugins API validators', function () {
30 // --------------------------------------------------------------- 30 // ---------------------------------------------------------------
31 31
32 before(async function () { 32 before(async function () {
33 this.timeout(30000) 33 this.timeout(60000)
34 34
35 server = await createSingleServer(1) 35 server = await createSingleServer(1)
36 36
diff --git a/server/tests/api/moderation/blocklist.ts b/server/tests/api/moderation/blocklist.ts
index 089af8b15..b3fd8ecac 100644
--- a/server/tests/api/moderation/blocklist.ts
+++ b/server/tests/api/moderation/blocklist.ts
@@ -254,6 +254,45 @@ describe('Test blocklist', function () {
254 } 254 }
255 }) 255 })
256 256
257 it('Should get blocked status', async function () {
258 const remoteHandle = 'user2@' + servers[1].host
259 const localHandle = 'user1@' + servers[0].host
260 const unknownHandle = 'user5@' + servers[0].host
261
262 {
263 const status = await command.getStatus({ accounts: [ remoteHandle ] })
264 expect(Object.keys(status.accounts)).to.have.lengthOf(1)
265 expect(status.accounts[remoteHandle].blockedByUser).to.be.false
266 expect(status.accounts[remoteHandle].blockedByServer).to.be.false
267
268 expect(Object.keys(status.hosts)).to.have.lengthOf(0)
269 }
270
271 {
272 const status = await command.getStatus({ token: servers[0].accessToken, accounts: [ remoteHandle ] })
273 expect(Object.keys(status.accounts)).to.have.lengthOf(1)
274 expect(status.accounts[remoteHandle].blockedByUser).to.be.true
275 expect(status.accounts[remoteHandle].blockedByServer).to.be.false
276
277 expect(Object.keys(status.hosts)).to.have.lengthOf(0)
278 }
279
280 {
281 const status = await command.getStatus({ token: servers[0].accessToken, accounts: [ localHandle, remoteHandle, unknownHandle ] })
282 expect(Object.keys(status.accounts)).to.have.lengthOf(3)
283
284 for (const handle of [ localHandle, remoteHandle ]) {
285 expect(status.accounts[handle].blockedByUser).to.be.true
286 expect(status.accounts[handle].blockedByServer).to.be.false
287 }
288
289 expect(status.accounts[unknownHandle].blockedByUser).to.be.false
290 expect(status.accounts[unknownHandle].blockedByServer).to.be.false
291
292 expect(Object.keys(status.hosts)).to.have.lengthOf(0)
293 }
294 })
295
257 it('Should not allow a remote blocked user to comment my videos', async function () { 296 it('Should not allow a remote blocked user to comment my videos', async function () {
258 this.timeout(60000) 297 this.timeout(60000)
259 298
@@ -434,6 +473,35 @@ describe('Test blocklist', function () {
434 expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port) 473 expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port)
435 }) 474 })
436 475
476 it('Should get blocklist status', async function () {
477 const blockedServer = servers[1].host
478 const notBlockedServer = 'example.com'
479
480 {
481 const status = await command.getStatus({ hosts: [ blockedServer, notBlockedServer ] })
482 expect(Object.keys(status.accounts)).to.have.lengthOf(0)
483
484 expect(Object.keys(status.hosts)).to.have.lengthOf(2)
485 expect(status.hosts[blockedServer].blockedByUser).to.be.false
486 expect(status.hosts[blockedServer].blockedByServer).to.be.false
487
488 expect(status.hosts[notBlockedServer].blockedByUser).to.be.false
489 expect(status.hosts[notBlockedServer].blockedByServer).to.be.false
490 }
491
492 {
493 const status = await command.getStatus({ token: servers[0].accessToken, hosts: [ blockedServer, notBlockedServer ] })
494 expect(Object.keys(status.accounts)).to.have.lengthOf(0)
495
496 expect(Object.keys(status.hosts)).to.have.lengthOf(2)
497 expect(status.hosts[blockedServer].blockedByUser).to.be.true
498 expect(status.hosts[blockedServer].blockedByServer).to.be.false
499
500 expect(status.hosts[notBlockedServer].blockedByUser).to.be.false
501 expect(status.hosts[notBlockedServer].blockedByServer).to.be.false
502 }
503 })
504
437 it('Should unblock the remote server', async function () { 505 it('Should unblock the remote server', async function () {
438 await command.removeFromMyBlocklist({ server: 'localhost:' + servers[1].port }) 506 await command.removeFromMyBlocklist({ server: 'localhost:' + servers[1].port })
439 }) 507 })
@@ -575,6 +643,27 @@ describe('Test blocklist', function () {
575 } 643 }
576 }) 644 })
577 645
646 it('Should get blocked status', async function () {
647 const remoteHandle = 'user2@' + servers[1].host
648 const localHandle = 'user1@' + servers[0].host
649 const unknownHandle = 'user5@' + servers[0].host
650
651 for (const token of [ undefined, servers[0].accessToken ]) {
652 const status = await command.getStatus({ token, accounts: [ localHandle, remoteHandle, unknownHandle ] })
653 expect(Object.keys(status.accounts)).to.have.lengthOf(3)
654
655 for (const handle of [ localHandle, remoteHandle ]) {
656 expect(status.accounts[handle].blockedByUser).to.be.false
657 expect(status.accounts[handle].blockedByServer).to.be.true
658 }
659
660 expect(status.accounts[unknownHandle].blockedByUser).to.be.false
661 expect(status.accounts[unknownHandle].blockedByServer).to.be.false
662
663 expect(Object.keys(status.hosts)).to.have.lengthOf(0)
664 }
665 })
666
578 it('Should unblock the remote account', async function () { 667 it('Should unblock the remote account', async function () {
579 await command.removeFromServerBlocklist({ account: 'user2@localhost:' + servers[1].port }) 668 await command.removeFromServerBlocklist({ account: 'user2@localhost:' + servers[1].port })
580 }) 669 })
@@ -620,6 +709,7 @@ describe('Test blocklist', function () {
620 }) 709 })
621 710
622 describe('When managing server blocklist', function () { 711 describe('When managing server blocklist', function () {
712
623 it('Should list all videos', async function () { 713 it('Should list all videos', async function () {
624 for (const token of [ userModeratorToken, servers[0].accessToken ]) { 714 for (const token of [ userModeratorToken, servers[0].accessToken ]) {
625 await checkAllVideos(servers[0], token) 715 await checkAllVideos(servers[0], token)
@@ -713,6 +803,23 @@ describe('Test blocklist', function () {
713 expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port) 803 expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port)
714 }) 804 })
715 805
806 it('Should get blocklist status', async function () {
807 const blockedServer = servers[1].host
808 const notBlockedServer = 'example.com'
809
810 for (const token of [ undefined, servers[0].accessToken ]) {
811 const status = await command.getStatus({ token, hosts: [ blockedServer, notBlockedServer ] })
812 expect(Object.keys(status.accounts)).to.have.lengthOf(0)
813
814 expect(Object.keys(status.hosts)).to.have.lengthOf(2)
815 expect(status.hosts[blockedServer].blockedByUser).to.be.false
816 expect(status.hosts[blockedServer].blockedByServer).to.be.true
817
818 expect(status.hosts[notBlockedServer].blockedByUser).to.be.false
819 expect(status.hosts[notBlockedServer].blockedByServer).to.be.false
820 }
821 })
822
716 it('Should unblock the remote server', async function () { 823 it('Should unblock the remote server', async function () {
717 await command.removeFromServerBlocklist({ server: 'localhost:' + servers[1].port }) 824 await command.removeFromServerBlocklist({ server: 'localhost:' + servers[1].port })
718 }) 825 })
diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts
index f806fed31..81ce8061b 100644
--- a/server/tests/api/notifications/moderation-notifications.ts
+++ b/server/tests/api/notifications/moderation-notifications.ts
@@ -24,11 +24,13 @@ import {
24 wait, 24 wait,
25 waitJobs 25 waitJobs
26} from '@shared/extra-utils' 26} from '@shared/extra-utils'
27import { AbuseState, CustomConfig, UserNotification, VideoPrivacy } from '@shared/models' 27import { AbuseState, CustomConfig, UserNotification, UserRole, VideoPrivacy } from '@shared/models'
28 28
29describe('Test moderation notifications', function () { 29describe('Test moderation notifications', function () {
30 let servers: PeerTubeServer[] = [] 30 let servers: PeerTubeServer[] = []
31 let userAccessToken: string 31 let userToken1: string
32 let userToken2: string
33
32 let userNotifications: UserNotification[] = [] 34 let userNotifications: UserNotification[] = []
33 let adminNotifications: UserNotification[] = [] 35 let adminNotifications: UserNotification[] = []
34 let adminNotificationsServer2: UserNotification[] = [] 36 let adminNotificationsServer2: UserNotification[] = []
@@ -39,11 +41,13 @@ describe('Test moderation notifications', function () {
39 41
40 const res = await prepareNotificationsTest(3) 42 const res = await prepareNotificationsTest(3)
41 emails = res.emails 43 emails = res.emails
42 userAccessToken = res.userAccessToken 44 userToken1 = res.userAccessToken
43 servers = res.servers 45 servers = res.servers
44 userNotifications = res.userNotifications 46 userNotifications = res.userNotifications
45 adminNotifications = res.adminNotifications 47 adminNotifications = res.adminNotifications
46 adminNotificationsServer2 = res.adminNotificationsServer2 48 adminNotificationsServer2 = res.adminNotificationsServer2
49
50 userToken2 = await servers[1].users.generateUserAndToken('user2', UserRole.USER)
47 }) 51 })
48 52
49 describe('Abuse for moderators notification', function () { 53 describe('Abuse for moderators notification', function () {
@@ -58,15 +62,27 @@ describe('Test moderation notifications', function () {
58 } 62 }
59 }) 63 })
60 64
61 it('Should send a notification to moderators on local video abuse', async function () { 65 it('Should not send a notification to moderators on local abuse reported by an admin', async function () {
62 this.timeout(20000) 66 this.timeout(20000)
63 67
64 const name = 'video for abuse ' + buildUUID() 68 const name = 'video for abuse ' + buildUUID()
65 const video = await servers[0].videos.upload({ token: userAccessToken, attributes: { name } }) 69 const video = await servers[0].videos.upload({ token: userToken1, attributes: { name } })
66 70
67 await servers[0].abuses.report({ videoId: video.id, reason: 'super reason' }) 71 await servers[0].abuses.report({ videoId: video.id, reason: 'super reason' })
68 72
69 await waitJobs(servers) 73 await waitJobs(servers)
74 await checkNewVideoAbuseForModerators({ ...baseParams, shortUUID: video.shortUUID, videoName: name, checkType: 'absence' })
75 })
76
77 it('Should send a notification to moderators on local video abuse', async function () {
78 this.timeout(20000)
79
80 const name = 'video for abuse ' + buildUUID()
81 const video = await servers[0].videos.upload({ token: userToken1, attributes: { name } })
82
83 await servers[0].abuses.report({ token: userToken1, videoId: video.id, reason: 'super reason' })
84
85 await waitJobs(servers)
70 await checkNewVideoAbuseForModerators({ ...baseParams, shortUUID: video.shortUUID, videoName: name, checkType: 'presence' }) 86 await checkNewVideoAbuseForModerators({ ...baseParams, shortUUID: video.shortUUID, videoName: name, checkType: 'presence' })
71 }) 87 })
72 88
@@ -74,12 +90,12 @@ describe('Test moderation notifications', function () {
74 this.timeout(20000) 90 this.timeout(20000)
75 91
76 const name = 'video for abuse ' + buildUUID() 92 const name = 'video for abuse ' + buildUUID()
77 const video = await servers[0].videos.upload({ token: userAccessToken, attributes: { name } }) 93 const video = await servers[0].videos.upload({ token: userToken1, attributes: { name } })
78 94
79 await waitJobs(servers) 95 await waitJobs(servers)
80 96
81 const videoId = await servers[1].videos.getId({ uuid: video.uuid }) 97 const videoId = await servers[1].videos.getId({ uuid: video.uuid })
82 await servers[1].abuses.report({ videoId, reason: 'super reason' }) 98 await servers[1].abuses.report({ token: userToken2, videoId, reason: 'super reason' })
83 99
84 await waitJobs(servers) 100 await waitJobs(servers)
85 await checkNewVideoAbuseForModerators({ ...baseParams, shortUUID: video.shortUUID, videoName: name, checkType: 'presence' }) 101 await checkNewVideoAbuseForModerators({ ...baseParams, shortUUID: video.shortUUID, videoName: name, checkType: 'presence' })
@@ -89,16 +105,16 @@ describe('Test moderation notifications', function () {
89 this.timeout(20000) 105 this.timeout(20000)
90 106
91 const name = 'video for abuse ' + buildUUID() 107 const name = 'video for abuse ' + buildUUID()
92 const video = await servers[0].videos.upload({ token: userAccessToken, attributes: { name } }) 108 const video = await servers[0].videos.upload({ token: userToken1, attributes: { name } })
93 const comment = await servers[0].comments.createThread({ 109 const comment = await servers[0].comments.createThread({
94 token: userAccessToken, 110 token: userToken1,
95 videoId: video.id, 111 videoId: video.id,
96 text: 'comment abuse ' + buildUUID() 112 text: 'comment abuse ' + buildUUID()
97 }) 113 })
98 114
99 await waitJobs(servers) 115 await waitJobs(servers)
100 116
101 await servers[0].abuses.report({ commentId: comment.id, reason: 'super reason' }) 117 await servers[0].abuses.report({ token: userToken1, commentId: comment.id, reason: 'super reason' })
102 118
103 await waitJobs(servers) 119 await waitJobs(servers)
104 await checkNewCommentAbuseForModerators({ ...baseParams, shortUUID: video.shortUUID, videoName: name, checkType: 'presence' }) 120 await checkNewCommentAbuseForModerators({ ...baseParams, shortUUID: video.shortUUID, videoName: name, checkType: 'presence' })
@@ -108,10 +124,10 @@ describe('Test moderation notifications', function () {
108 this.timeout(20000) 124 this.timeout(20000)
109 125
110 const name = 'video for abuse ' + buildUUID() 126 const name = 'video for abuse ' + buildUUID()
111 const video = await servers[0].videos.upload({ token: userAccessToken, attributes: { name } }) 127 const video = await servers[0].videos.upload({ token: userToken1, attributes: { name } })
112 128
113 await servers[0].comments.createThread({ 129 await servers[0].comments.createThread({
114 token: userAccessToken, 130 token: userToken1,
115 videoId: video.id, 131 videoId: video.id,
116 text: 'comment abuse ' + buildUUID() 132 text: 'comment abuse ' + buildUUID()
117 }) 133 })
@@ -120,7 +136,7 @@ describe('Test moderation notifications', function () {
120 136
121 const { data } = await servers[1].comments.listThreads({ videoId: video.uuid }) 137 const { data } = await servers[1].comments.listThreads({ videoId: video.uuid })
122 const commentId = data[0].id 138 const commentId = data[0].id
123 await servers[1].abuses.report({ commentId, reason: 'super reason' }) 139 await servers[1].abuses.report({ token: userToken2, commentId, reason: 'super reason' })
124 140
125 await waitJobs(servers) 141 await waitJobs(servers)
126 await checkNewCommentAbuseForModerators({ ...baseParams, shortUUID: video.shortUUID, videoName: name, checkType: 'presence' }) 142 await checkNewCommentAbuseForModerators({ ...baseParams, shortUUID: video.shortUUID, videoName: name, checkType: 'presence' })
@@ -133,7 +149,7 @@ describe('Test moderation notifications', function () {
133 const { account } = await servers[0].users.create({ username, password: 'donald' }) 149 const { account } = await servers[0].users.create({ username, password: 'donald' })
134 const accountId = account.id 150 const accountId = account.id
135 151
136 await servers[0].abuses.report({ accountId, reason: 'super reason' }) 152 await servers[0].abuses.report({ token: userToken1, accountId, reason: 'super reason' })
137 153
138 await waitJobs(servers) 154 await waitJobs(servers)
139 await checkNewAccountAbuseForModerators({ ...baseParams, displayName: username, checkType: 'presence' }) 155 await checkNewAccountAbuseForModerators({ ...baseParams, displayName: username, checkType: 'presence' })
@@ -149,7 +165,7 @@ describe('Test moderation notifications', function () {
149 await waitJobs(servers) 165 await waitJobs(servers)
150 166
151 const account = await servers[1].accounts.get({ accountName: username + '@' + servers[0].host }) 167 const account = await servers[1].accounts.get({ accountName: username + '@' + servers[0].host })
152 await servers[1].abuses.report({ accountId: account.id, reason: 'super reason' }) 168 await servers[1].abuses.report({ token: userToken2, accountId: account.id, reason: 'super reason' })
153 169
154 await waitJobs(servers) 170 await waitJobs(servers)
155 await checkNewAccountAbuseForModerators({ ...baseParams, displayName: username, checkType: 'presence' }) 171 await checkNewAccountAbuseForModerators({ ...baseParams, displayName: username, checkType: 'presence' })
@@ -165,13 +181,13 @@ describe('Test moderation notifications', function () {
165 server: servers[0], 181 server: servers[0],
166 emails, 182 emails,
167 socketNotifications: userNotifications, 183 socketNotifications: userNotifications,
168 token: userAccessToken 184 token: userToken1
169 } 185 }
170 186
171 const name = 'abuse ' + buildUUID() 187 const name = 'abuse ' + buildUUID()
172 const video = await servers[0].videos.upload({ token: userAccessToken, attributes: { name } }) 188 const video = await servers[0].videos.upload({ token: userToken1, attributes: { name } })
173 189
174 const body = await servers[0].abuses.report({ token: userAccessToken, videoId: video.id, reason: 'super reason' }) 190 const body = await servers[0].abuses.report({ token: userToken1, videoId: video.id, reason: 'super reason' })
175 abuseId = body.abuse.id 191 abuseId = body.abuse.id
176 }) 192 })
177 193
@@ -205,7 +221,7 @@ describe('Test moderation notifications', function () {
205 server: servers[0], 221 server: servers[0],
206 emails, 222 emails,
207 socketNotifications: userNotifications, 223 socketNotifications: userNotifications,
208 token: userAccessToken 224 token: userToken1
209 } 225 }
210 226
211 baseParamsAdmin = { 227 baseParamsAdmin = {
@@ -216,15 +232,15 @@ describe('Test moderation notifications', function () {
216 } 232 }
217 233
218 const name = 'abuse ' + buildUUID() 234 const name = 'abuse ' + buildUUID()
219 const video = await servers[0].videos.upload({ token: userAccessToken, attributes: { name } }) 235 const video = await servers[0].videos.upload({ token: userToken1, attributes: { name } })
220 236
221 { 237 {
222 const body = await servers[0].abuses.report({ token: userAccessToken, videoId: video.id, reason: 'super reason' }) 238 const body = await servers[0].abuses.report({ token: userToken1, videoId: video.id, reason: 'super reason' })
223 abuseId = body.abuse.id 239 abuseId = body.abuse.id
224 } 240 }
225 241
226 { 242 {
227 const body = await servers[0].abuses.report({ token: userAccessToken, videoId: video.id, reason: 'super reason 2' }) 243 const body = await servers[0].abuses.report({ token: userToken1, videoId: video.id, reason: 'super reason 2' })
228 abuseId2 = body.abuse.id 244 abuseId2 = body.abuse.id
229 } 245 }
230 }) 246 })
@@ -254,7 +270,7 @@ describe('Test moderation notifications', function () {
254 this.timeout(10000) 270 this.timeout(10000)
255 271
256 const message = 'my super message to moderators' 272 const message = 'my super message to moderators'
257 await servers[0].abuses.addMessage({ token: userAccessToken, abuseId: abuseId2, message }) 273 await servers[0].abuses.addMessage({ token: userToken1, abuseId: abuseId2, message })
258 await waitJobs(servers) 274 await waitJobs(servers)
259 275
260 const toEmail = 'admin' + servers[0].internalServerNumber + '@example.com' 276 const toEmail = 'admin' + servers[0].internalServerNumber + '@example.com'
@@ -265,7 +281,7 @@ describe('Test moderation notifications', function () {
265 this.timeout(10000) 281 this.timeout(10000)
266 282
267 const message = 'my super message that should not be sent to reporter' 283 const message = 'my super message that should not be sent to reporter'
268 await servers[0].abuses.addMessage({ token: userAccessToken, abuseId: abuseId2, message }) 284 await servers[0].abuses.addMessage({ token: userToken1, abuseId: abuseId2, message })
269 await waitJobs(servers) 285 await waitJobs(servers)
270 286
271 const toEmail = 'user_1@example.com' 287 const toEmail = 'user_1@example.com'
@@ -281,7 +297,7 @@ describe('Test moderation notifications', function () {
281 server: servers[0], 297 server: servers[0],
282 emails, 298 emails,
283 socketNotifications: userNotifications, 299 socketNotifications: userNotifications,
284 token: userAccessToken 300 token: userToken1
285 } 301 }
286 }) 302 })
287 303
@@ -289,7 +305,7 @@ describe('Test moderation notifications', function () {
289 this.timeout(10000) 305 this.timeout(10000)
290 306
291 const name = 'video for abuse ' + buildUUID() 307 const name = 'video for abuse ' + buildUUID()
292 const { uuid, shortUUID } = await servers[0].videos.upload({ token: userAccessToken, attributes: { name } }) 308 const { uuid, shortUUID } = await servers[0].videos.upload({ token: userToken1, attributes: { name } })
293 309
294 await servers[0].blacklist.add({ videoId: uuid }) 310 await servers[0].blacklist.add({ videoId: uuid })
295 311
@@ -301,7 +317,7 @@ describe('Test moderation notifications', function () {
301 this.timeout(10000) 317 this.timeout(10000)
302 318
303 const name = 'video for abuse ' + buildUUID() 319 const name = 'video for abuse ' + buildUUID()
304 const { uuid, shortUUID } = await servers[0].videos.upload({ token: userAccessToken, attributes: { name } }) 320 const { uuid, shortUUID } = await servers[0].videos.upload({ token: userToken1, attributes: { name } })
305 321
306 await servers[0].blacklist.add({ videoId: uuid }) 322 await servers[0].blacklist.add({ videoId: uuid })
307 323
@@ -335,7 +351,7 @@ describe('Test moderation notifications', function () {
335 351
336 await checkUserRegistered({ ...baseParams, username: 'user_45', checkType: 'presence' }) 352 await checkUserRegistered({ ...baseParams, username: 'user_45', checkType: 'presence' })
337 353
338 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } } 354 const userOverride = { socketNotifications: userNotifications, token: userToken1, check: { web: true, mail: false } }
339 await checkUserRegistered({ ...baseParams, ...userOverride, username: 'user_45', checkType: 'absence' }) 355 await checkUserRegistered({ ...baseParams, ...userOverride, username: 'user_45', checkType: 'absence' })
340 }) 356 })
341 }) 357 })
@@ -377,7 +393,7 @@ describe('Test moderation notifications', function () {
377 393
378 await checkNewInstanceFollower({ ...baseParams, followerHost: 'localhost:' + servers[2].port, checkType: 'presence' }) 394 await checkNewInstanceFollower({ ...baseParams, followerHost: 'localhost:' + servers[2].port, checkType: 'presence' })
379 395
380 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } } 396 const userOverride = { socketNotifications: userNotifications, token: userToken1, check: { web: true, mail: false } }
381 await checkNewInstanceFollower({ ...baseParams, ...userOverride, followerHost: 'localhost:' + servers[2].port, checkType: 'absence' }) 397 await checkNewInstanceFollower({ ...baseParams, ...userOverride, followerHost: 'localhost:' + servers[2].port, checkType: 'absence' })
382 }) 398 })
383 399
@@ -404,7 +420,7 @@ describe('Test moderation notifications', function () {
404 const followingHost = servers[2].host 420 const followingHost = servers[2].host
405 await checkAutoInstanceFollowing({ ...baseParams, followerHost, followingHost, checkType: 'presence' }) 421 await checkAutoInstanceFollowing({ ...baseParams, followerHost, followingHost, checkType: 'presence' })
406 422
407 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } } 423 const userOverride = { socketNotifications: userNotifications, token: userToken1, check: { web: true, mail: false } }
408 await checkAutoInstanceFollowing({ ...baseParams, ...userOverride, followerHost, followingHost, checkType: 'absence' }) 424 await checkAutoInstanceFollowing({ ...baseParams, ...userOverride, followerHost, followingHost, checkType: 'absence' })
409 425
410 config.followings.instance.autoFollowBack.enabled = false 426 config.followings.instance.autoFollowBack.enabled = false
@@ -461,7 +477,7 @@ describe('Test moderation notifications', function () {
461 server: servers[0], 477 server: servers[0],
462 emails, 478 emails,
463 socketNotifications: userNotifications, 479 socketNotifications: userNotifications,
464 token: userAccessToken 480 token: userToken1
465 } 481 }
466 482
467 currentCustomConfig = await servers[0].config.getCustomConfig() 483 currentCustomConfig = await servers[0].config.getCustomConfig()
@@ -490,7 +506,7 @@ describe('Test moderation notifications', function () {
490 this.timeout(120000) 506 this.timeout(120000)
491 507
492 videoName = 'video with auto-blacklist ' + buildUUID() 508 videoName = 'video with auto-blacklist ' + buildUUID()
493 const video = await servers[0].videos.upload({ token: userAccessToken, attributes: { name: videoName } }) 509 const video = await servers[0].videos.upload({ token: userToken1, attributes: { name: videoName } })
494 shortUUID = video.shortUUID 510 shortUUID = video.shortUUID
495 uuid = video.uuid 511 uuid = video.uuid
496 512
@@ -547,7 +563,7 @@ describe('Test moderation notifications', function () {
547 } 563 }
548 } 564 }
549 565
550 const { shortUUID, uuid } = await servers[0].videos.upload({ token: userAccessToken, attributes }) 566 const { shortUUID, uuid } = await servers[0].videos.upload({ token: userToken1, attributes })
551 567
552 await servers[0].blacklist.remove({ videoId: uuid }) 568 await servers[0].blacklist.remove({ videoId: uuid })
553 569
@@ -579,7 +595,7 @@ describe('Test moderation notifications', function () {
579 } 595 }
580 } 596 }
581 597
582 const { shortUUID } = await servers[0].videos.upload({ token: userAccessToken, attributes }) 598 const { shortUUID } = await servers[0].videos.upload({ token: userToken1, attributes })
583 599
584 await wait(6000) 600 await wait(6000)
585 await checkVideoIsPublished({ ...userBaseParams, videoName: name, shortUUID, checkType: 'absence' }) 601 await checkVideoIsPublished({ ...userBaseParams, videoName: name, shortUUID, checkType: 'absence' })
diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts
index 468efdf35..9af20843e 100644
--- a/server/tests/api/notifications/user-notifications.ts
+++ b/server/tests/api/notifications/user-notifications.ts
@@ -267,7 +267,7 @@ describe('Test user notifications', function () {
267 }) 267 })
268 268
269 it('Should send a notification when an imported video is transcoded', async function () { 269 it('Should send a notification when an imported video is transcoded', async function () {
270 this.timeout(50000) 270 this.timeout(120000)
271 271
272 const name = 'video import ' + buildUUID() 272 const name = 'video import ' + buildUUID()
273 273
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts
index 86b40cfe6..b5929129a 100644
--- a/server/tests/api/redundancy/redundancy.ts
+++ b/server/tests/api/redundancy/redundancy.ts
@@ -307,7 +307,7 @@ describe('Test videos redundancy', function () {
307 const strategy = 'most-views' 307 const strategy = 'most-views'
308 308
309 before(function () { 309 before(function () {
310 this.timeout(120000) 310 this.timeout(240000)
311 311
312 return createServers(strategy) 312 return createServers(strategy)
313 }) 313 })
@@ -357,7 +357,7 @@ describe('Test videos redundancy', function () {
357 const strategy = 'trending' 357 const strategy = 'trending'
358 358
359 before(function () { 359 before(function () {
360 this.timeout(120000) 360 this.timeout(240000)
361 361
362 return createServers(strategy) 362 return createServers(strategy)
363 }) 363 })
@@ -420,7 +420,7 @@ describe('Test videos redundancy', function () {
420 const strategy = 'recently-added' 420 const strategy = 'recently-added'
421 421
422 before(function () { 422 before(function () {
423 this.timeout(120000) 423 this.timeout(240000)
424 424
425 return createServers(strategy, { min_views: 3 }) 425 return createServers(strategy, { min_views: 3 })
426 }) 426 })
@@ -491,7 +491,7 @@ describe('Test videos redundancy', function () {
491 const strategy = 'recently-added' 491 const strategy = 'recently-added'
492 492
493 before(async function () { 493 before(async function () {
494 this.timeout(120000) 494 this.timeout(240000)
495 495
496 await createServers(strategy, { min_views: 3 }, false) 496 await createServers(strategy, { min_views: 3 }, false)
497 }) 497 })
@@ -553,7 +553,7 @@ describe('Test videos redundancy', function () {
553 553
554 describe('With manual strategy', function () { 554 describe('With manual strategy', function () {
555 before(function () { 555 before(function () {
556 this.timeout(120000) 556 this.timeout(240000)
557 557
558 return createServers(null) 558 return createServers(null)
559 }) 559 })
@@ -632,7 +632,7 @@ describe('Test videos redundancy', function () {
632 } 632 }
633 633
634 before(async function () { 634 before(async function () {
635 this.timeout(120000) 635 this.timeout(240000)
636 636
637 await createServers(strategy, { min_lifetime: '7 seconds', min_views: 0 }) 637 await createServers(strategy, { min_lifetime: '7 seconds', min_views: 0 })
638 638
@@ -674,7 +674,7 @@ describe('Test videos redundancy', function () {
674 const strategy = 'recently-added' 674 const strategy = 'recently-added'
675 675
676 before(async function () { 676 before(async function () {
677 this.timeout(120000) 677 this.timeout(240000)
678 678
679 await createServers(strategy, { min_lifetime: '7 seconds', min_views: 0 }) 679 await createServers(strategy, { min_lifetime: '7 seconds', min_views: 0 })
680 680
@@ -698,7 +698,7 @@ describe('Test videos redundancy', function () {
698 }) 698 })
699 699
700 it('Should cache video 2 webseeds on the first video', async function () { 700 it('Should cache video 2 webseeds on the first video', async function () {
701 this.timeout(120000) 701 this.timeout(240000)
702 702
703 await waitJobs(servers) 703 await waitJobs(servers)
704 704
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts
index ea524723c..96ec17b0f 100644
--- a/server/tests/api/server/config.ts
+++ b/server/tests/api/server/config.ts
@@ -43,6 +43,9 @@ function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) {
43 expect(data.services.twitter.username).to.equal('@Chocobozzz') 43 expect(data.services.twitter.username).to.equal('@Chocobozzz')
44 expect(data.services.twitter.whitelisted).to.be.false 44 expect(data.services.twitter.whitelisted).to.be.false
45 45
46 expect(data.client.videos.miniature.preferAuthorDisplayName).to.be.false
47 expect(data.client.menu.login.redirectOnSingleExternalAuth).to.be.false
48
46 expect(data.cache.previews.size).to.equal(1) 49 expect(data.cache.previews.size).to.equal(1)
47 expect(data.cache.captions.size).to.equal(1) 50 expect(data.cache.captions.size).to.equal(1)
48 expect(data.cache.torrents.size).to.equal(1) 51 expect(data.cache.torrents.size).to.equal(1)
@@ -138,6 +141,9 @@ function checkUpdatedConfig (data: CustomConfig) {
138 expect(data.services.twitter.username).to.equal('@Kuja') 141 expect(data.services.twitter.username).to.equal('@Kuja')
139 expect(data.services.twitter.whitelisted).to.be.true 142 expect(data.services.twitter.whitelisted).to.be.true
140 143
144 expect(data.client.videos.miniature.preferAuthorDisplayName).to.be.true
145 expect(data.client.menu.login.redirectOnSingleExternalAuth).to.be.true
146
141 expect(data.cache.previews.size).to.equal(2) 147 expect(data.cache.previews.size).to.equal(2)
142 expect(data.cache.captions.size).to.equal(3) 148 expect(data.cache.captions.size).to.equal(3)
143 expect(data.cache.torrents.size).to.equal(4) 149 expect(data.cache.torrents.size).to.equal(4)
@@ -246,6 +252,18 @@ const newCustomConfig: CustomConfig = {
246 whitelisted: true 252 whitelisted: true
247 } 253 }
248 }, 254 },
255 client: {
256 videos: {
257 miniature: {
258 preferAuthorDisplayName: true
259 }
260 },
261 menu: {
262 login: {
263 redirectOnSingleExternalAuth: true
264 }
265 }
266 },
249 cache: { 267 cache: {
250 previews: { 268 previews: {
251 size: 2 269 size: 2
diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts
index 5f97edbc2..cd8d70341 100644
--- a/server/tests/api/server/email.ts
+++ b/server/tests/api/server/email.ts
@@ -185,7 +185,7 @@ describe('Test emails', function () {
185 this.timeout(10000) 185 this.timeout(10000)
186 186
187 const reason = 'my super bad reason' 187 const reason = 'my super bad reason'
188 await server.abuses.report({ videoId, reason }) 188 await server.abuses.report({ token: userAccessToken, videoId, reason })
189 189
190 await waitJobs(server) 190 await waitJobs(server)
191 expect(emails).to.have.lengthOf(3) 191 expect(emails).to.have.lengthOf(3)
diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts
index b51b3bcdd..08b624ff3 100644
--- a/server/tests/api/videos/video-privacy.ts
+++ b/server/tests/api/videos/video-privacy.ts
@@ -2,7 +2,15 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { cleanupTests, createSingleServer, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' 5import {
6 cleanupTests,
7 createSingleServer,
8 doubleFollow,
9 PeerTubeServer,
10 setAccessTokensToServers,
11 wait,
12 waitJobs
13} from '@shared/extra-utils'
6import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' 14import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models'
7 15
8const expect = chai.expect 16const expect = chai.expect
@@ -209,7 +217,7 @@ describe('Test video privacy', function () {
209 describe('Privacy update', function () { 217 describe('Privacy update', function () {
210 218
211 it('Should update the private and internal videos to public on server 1', async function () { 219 it('Should update the private and internal videos to public on server 1', async function () {
212 this.timeout(10000) 220 this.timeout(100000)
213 221
214 now = Date.now() 222 now = Date.now()
215 223
@@ -230,6 +238,7 @@ describe('Test video privacy', function () {
230 await servers[0].videos.update({ id: internalVideoId, attributes }) 238 await servers[0].videos.update({ id: internalVideoId, attributes })
231 } 239 }
232 240
241 await wait(10000)
233 await waitJobs(servers) 242 await waitJobs(servers)
234 }) 243 })
235 244