+ await checkServer1And2HasFollowers(servers)
+ })
+
+ it('Should manually approve followers', async function () {
+ this.timeout(20000)
+
+ await commands[1].removeFollower({ follower: servers[0] })
+ await waitJobs(servers)
+
+ const subConfig = {
+ followers: {
+ instance: {
+ enabled: true,
+ manualApproval: true
+ }
+ }
+ }
+
+ await servers[1].config.updateCustomSubConfig({ newConfig: subConfig })
+ await servers[2].config.updateCustomSubConfig({ newConfig: subConfig })
+
+ await commands[0].follow({ hosts: [ servers[1].url ] })
+ await waitJobs(servers)
+
+ await checkServer1And2HasFollowers(servers, 'pending')
+ })
+
+ it('Should accept a follower', async function () {
+ this.timeout(10000)
+
+ await commands[1].acceptFollower({ follower: 'peertube@localhost:' + servers[0].port })
+ await waitJobs(servers)
+
+ await checkServer1And2HasFollowers(servers)
+ })
+
+ it('Should reject another follower', async function () {
+ this.timeout(20000)
+
+ await commands[0].follow({ hosts: [ servers[2].url ] })
+ await waitJobs(servers)
+
+ {
+ const body = await commands[0].getFollowings({ start: 0, count: 5, sort: 'createdAt' })
+ expect(body.total).to.equal(2)
+ }
+
+ {
+ const body = await commands[1].getFollowers({ start: 0, count: 5, sort: 'createdAt' })
+ expect(body.total).to.equal(1)
+ }
+
+ {
+ const body = await commands[2].getFollowers({ start: 0, count: 5, sort: 'createdAt' })
+ expect(body.total).to.equal(1)
+ }
+
+ await commands[2].rejectFollower({ follower: 'peertube@localhost:' + servers[0].port })
+ await waitJobs(servers)
+
+ await checkServer1And2HasFollowers(servers)
+
+ {
+ const body = await commands[2].getFollowers({ start: 0, count: 5, sort: 'createdAt' })
+ expect(body.total).to.equal(0)
+ }