aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/notifications
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-07 11:51:09 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:17 +0200
commit65e6e2602c0d5521f3a6740f7469bb92830ecb53 (patch)
treef89024ffff1dafb0281ee2fe028e89b95101bd44 /server/tests/api/notifications
parentbc8090411ddaa8d742ce4de3c83f9dba7bc18e2a (diff)
downloadPeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.tar.gz
PeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.tar.zst
PeerTube-65e6e2602c0d5521f3a6740f7469bb92830ecb53.zip
Introduce config command
Diffstat (limited to 'server/tests/api/notifications')
-rw-r--r--server/tests/api/notifications/moderation-notifications.ts20
1 files changed, 9 insertions, 11 deletions
diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts
index 9a93ce401..3e66e7517 100644
--- a/server/tests/api/notifications/moderation-notifications.ts
+++ b/server/tests/api/notifications/moderation-notifications.ts
@@ -23,7 +23,6 @@ import {
23 createUser, 23 createUser,
24 generateUserAccessToken, 24 generateUserAccessToken,
25 getAccount, 25 getAccount,
26 getCustomConfig,
27 getVideoCommentThreads, 26 getVideoCommentThreads,
28 getVideoIdFromUUID, 27 getVideoIdFromUUID,
29 immutableAssign, 28 immutableAssign,
@@ -34,8 +33,6 @@ import {
34 removeUserSubscription, 33 removeUserSubscription,
35 removeVideoFromBlacklist, 34 removeVideoFromBlacklist,
36 ServerInfo, 35 ServerInfo,
37 updateCustomConfig,
38 updateCustomSubConfig,
39 uploadVideo, 36 uploadVideo,
40 wait, 37 wait,
41 waitJobs 38 waitJobs
@@ -407,7 +404,7 @@ describe('Test moderation notifications', function () {
407 } 404 }
408 } 405 }
409 } 406 }
410 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) 407 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
411 408
412 await servers[2].followsCommand.follow({ targets: [ servers[0].url ] }) 409 await servers[2].followsCommand.follow({ targets: [ servers[0].url ] })
413 410
@@ -421,7 +418,7 @@ describe('Test moderation notifications', function () {
421 await checkAutoInstanceFollowing(immutableAssign(baseParams, userOverride), followerHost, followingHost, 'absence') 418 await checkAutoInstanceFollowing(immutableAssign(baseParams, userOverride), followerHost, followingHost, 'absence')
422 419
423 config.followings.instance.autoFollowBack.enabled = false 420 config.followings.instance.autoFollowBack.enabled = false
424 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) 421 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
425 await servers[0].followsCommand.unfollow({ target: servers[2] }) 422 await servers[0].followsCommand.unfollow({ target: servers[2] })
426 await servers[2].followsCommand.unfollow({ target: servers[0] }) 423 await servers[2].followsCommand.unfollow({ target: servers[0] })
427 }) 424 })
@@ -430,7 +427,7 @@ describe('Test moderation notifications', function () {
430 this.timeout(30000) 427 this.timeout(30000)
431 await servers[0].followsCommand.unfollow({ target: servers[1] }) 428 await servers[0].followsCommand.unfollow({ target: servers[1] })
432 429
433 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) 430 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
434 431
435 await wait(5000) 432 await wait(5000)
436 await waitJobs(servers) 433 await waitJobs(servers)
@@ -440,7 +437,7 @@ describe('Test moderation notifications', function () {
440 await checkAutoInstanceFollowing(baseParams, followerHost, followingHost, 'presence') 437 await checkAutoInstanceFollowing(baseParams, followerHost, followingHost, 'presence')
441 438
442 config.followings.instance.autoFollowIndex.enabled = false 439 config.followings.instance.autoFollowIndex.enabled = false
443 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) 440 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
444 await servers[0].followsCommand.unfollow({ target: servers[1] }) 441 await servers[0].followsCommand.unfollow({ target: servers[1] })
445 }) 442 })
446 }) 443 })
@@ -476,8 +473,8 @@ describe('Test moderation notifications', function () {
476 token: userAccessToken 473 token: userAccessToken
477 } 474 }
478 475
479 const resCustomConfig = await getCustomConfig(servers[0].url, servers[0].accessToken) 476 currentCustomConfig = await servers[0].configCommand.getCustomConfig()
480 currentCustomConfig = resCustomConfig.body 477
481 const autoBlacklistTestsCustomConfig = immutableAssign(currentCustomConfig, { 478 const autoBlacklistTestsCustomConfig = immutableAssign(currentCustomConfig, {
482 autoBlacklist: { 479 autoBlacklist: {
483 videos: { 480 videos: {
@@ -487,9 +484,10 @@ describe('Test moderation notifications', function () {
487 } 484 }
488 } 485 }
489 }) 486 })
487
490 // enable transcoding otherwise own publish notification after transcoding not expected 488 // enable transcoding otherwise own publish notification after transcoding not expected
491 autoBlacklistTestsCustomConfig.transcoding.enabled = true 489 autoBlacklistTestsCustomConfig.transcoding.enabled = true
492 await updateCustomConfig(servers[0].url, servers[0].accessToken, autoBlacklistTestsCustomConfig) 490 await servers[0].configCommand.updateCustomConfig({ newCustomConfig: autoBlacklistTestsCustomConfig })
493 491
494 await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port) 492 await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port)
495 await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port) 493 await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port)
@@ -612,7 +610,7 @@ describe('Test moderation notifications', function () {
612 }) 610 })
613 611
614 after(async () => { 612 after(async () => {
615 await updateCustomConfig(servers[0].url, servers[0].accessToken, currentCustomConfig) 613 await servers[0].configCommand.updateCustomConfig({ newCustomConfig: currentCustomConfig })
616 614
617 await removeUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port) 615 await removeUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port)
618 await removeUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port) 616 await removeUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port)