aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/notifications
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-13 09:43:59 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit6c5065a011b099618681a37bd77eaa7bd3db752e (patch)
tree352252a00b25013c4b1902f6bcd9668aba295c7b /server/tests/api/notifications
parent0d8ecb7592577f54012413a2b5a9b159cfc90399 (diff)
downloadPeerTube-6c5065a011b099618681a37bd77eaa7bd3db752e.tar.gz
PeerTube-6c5065a011b099618681a37bd77eaa7bd3db752e.tar.zst
PeerTube-6c5065a011b099618681a37bd77eaa7bd3db752e.zip
Introduce server commands
Diffstat (limited to 'server/tests/api/notifications')
-rw-r--r--server/tests/api/notifications/moderation-notifications.ts13
-rw-r--r--server/tests/api/notifications/notifications-api.ts11
2 files changed, 12 insertions, 12 deletions
diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts
index 229f78811..99b434606 100644
--- a/server/tests/api/notifications/moderation-notifications.ts
+++ b/server/tests/api/notifications/moderation-notifications.ts
@@ -20,7 +20,6 @@ import {
20 createUser, 20 createUser,
21 generateUserAccessToken, 21 generateUserAccessToken,
22 getVideoIdFromUUID, 22 getVideoIdFromUUID,
23 immutableAssign,
24 MockInstancesIndex, 23 MockInstancesIndex,
25 MockSmtpServer, 24 MockSmtpServer,
26 prepareNotificationsTest, 25 prepareNotificationsTest,
@@ -347,7 +346,7 @@ describe('Test moderation notifications', function () {
347 await checkUserRegistered(baseParams, 'user_45', 'presence') 346 await checkUserRegistered(baseParams, 'user_45', 'presence')
348 347
349 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } } 348 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } }
350 await checkUserRegistered(immutableAssign(baseParams, userOverride), 'user_45', 'absence') 349 await checkUserRegistered({ ...baseParams, ...userOverride }, 'user_45', 'absence')
351 }) 350 })
352 }) 351 })
353 352
@@ -389,7 +388,7 @@ describe('Test moderation notifications', function () {
389 await checkNewInstanceFollower(baseParams, 'localhost:' + servers[2].port, 'presence') 388 await checkNewInstanceFollower(baseParams, 'localhost:' + servers[2].port, 'presence')
390 389
391 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } } 390 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } }
392 await checkNewInstanceFollower(immutableAssign(baseParams, userOverride), 'localhost:' + servers[2].port, 'absence') 391 await checkNewInstanceFollower({ ...baseParams, ...userOverride }, 'localhost:' + servers[2].port, 'absence')
393 }) 392 })
394 393
395 it('Should send a notification on auto follow back', async function () { 394 it('Should send a notification on auto follow back', async function () {
@@ -416,7 +415,7 @@ describe('Test moderation notifications', function () {
416 await checkAutoInstanceFollowing(baseParams, followerHost, followingHost, 'presence') 415 await checkAutoInstanceFollowing(baseParams, followerHost, followingHost, 'presence')
417 416
418 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } } 417 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } }
419 await checkAutoInstanceFollowing(immutableAssign(baseParams, userOverride), followerHost, followingHost, 'absence') 418 await checkAutoInstanceFollowing({ ...baseParams, ...userOverride }, followerHost, followingHost, 'absence')
420 419
421 config.followings.instance.autoFollowBack.enabled = false 420 config.followings.instance.autoFollowBack.enabled = false
422 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config }) 421 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
@@ -476,7 +475,9 @@ describe('Test moderation notifications', function () {
476 475
477 currentCustomConfig = await servers[0].configCommand.getCustomConfig() 476 currentCustomConfig = await servers[0].configCommand.getCustomConfig()
478 477
479 const autoBlacklistTestsCustomConfig = immutableAssign(currentCustomConfig, { 478 const autoBlacklistTestsCustomConfig = {
479 ...currentCustomConfig,
480
480 autoBlacklist: { 481 autoBlacklist: {
481 videos: { 482 videos: {
482 ofUsers: { 483 ofUsers: {
@@ -484,7 +485,7 @@ describe('Test moderation notifications', function () {
484 } 485 }
485 } 486 }
486 } 487 }
487 }) 488 }
488 489
489 // enable transcoding otherwise own publish notification after transcoding not expected 490 // enable transcoding otherwise own publish notification after transcoding not expected
490 autoBlacklistTestsCustomConfig.transcoding.enabled = true 491 autoBlacklistTestsCustomConfig.transcoding.enabled = true
diff --git a/server/tests/api/notifications/notifications-api.ts b/server/tests/api/notifications/notifications-api.ts
index 447492c5f..e5864f1c2 100644
--- a/server/tests/api/notifications/notifications-api.ts
+++ b/server/tests/api/notifications/notifications-api.ts
@@ -8,7 +8,6 @@ import {
8 cleanupTests, 8 cleanupTests,
9 getAllNotificationsSettings, 9 getAllNotificationsSettings,
10 getMyUserInformation, 10 getMyUserInformation,
11 immutableAssign,
12 MockSmtpServer, 11 MockSmtpServer,
13 prepareNotificationsTest, 12 prepareNotificationsTest,
14 ServerInfo, 13 ServerInfo,
@@ -118,7 +117,7 @@ describe('Test notifications API', function () {
118 const { name, uuid } = await uploadRandomVideo(server) 117 const { name, uuid } = await uploadRandomVideo(server)
119 118
120 const check = { web: true, mail: true } 119 const check = { web: true, mail: true }
121 await checkNewVideoFromSubscription(immutableAssign(baseParams, { check }), name, uuid, 'absence') 120 await checkNewVideoFromSubscription({ ...baseParams, ...check }, name, uuid, 'absence')
122 }) 121 })
123 122
124 it('Should only have web notifications', async function () { 123 it('Should only have web notifications', async function () {
@@ -139,12 +138,12 @@ describe('Test notifications API', function () {
139 138
140 { 139 {
141 const check = { mail: true, web: false } 140 const check = { mail: true, web: false }
142 await checkNewVideoFromSubscription(immutableAssign(baseParams, { check }), name, uuid, 'absence') 141 await checkNewVideoFromSubscription({ ...baseParams, ...check }, name, uuid, 'absence')
143 } 142 }
144 143
145 { 144 {
146 const check = { mail: false, web: true } 145 const check = { mail: false, web: true }
147 await checkNewVideoFromSubscription(immutableAssign(baseParams, { check }), name, uuid, 'presence') 146 await checkNewVideoFromSubscription({ ...baseParams, ...check }, name, uuid, 'presence')
148 } 147 }
149 }) 148 })
150 149
@@ -166,12 +165,12 @@ describe('Test notifications API', function () {
166 165
167 { 166 {
168 const check = { mail: false, web: true } 167 const check = { mail: false, web: true }
169 await checkNewVideoFromSubscription(immutableAssign(baseParams, { check }), name, uuid, 'absence') 168 await checkNewVideoFromSubscription({ ...baseParams, ...check }, name, uuid, 'absence')
170 } 169 }
171 170
172 { 171 {
173 const check = { mail: true, web: false } 172 const check = { mail: true, web: false }
174 await checkNewVideoFromSubscription(immutableAssign(baseParams, { check }), name, uuid, 'presence') 173 await checkNewVideoFromSubscription({ ...baseParams, ...check }, name, uuid, 'presence')
175 } 174 }
176 }) 175 })
177 176