diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-12 11:47:45 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-12 11:47:45 +0100 |
commit | 32b2b43c06621e384c0bd1610ef0bb9f23399be7 (patch) | |
tree | c195943354838bcbe3b1993d77aaf0d3200fd19d /server/tests/api | |
parent | 6502c3d43e512e968ad49f5a3bc9abc302471e18 (diff) | |
download | PeerTube-32b2b43c06621e384c0bd1610ef0bb9f23399be7.tar.gz PeerTube-32b2b43c06621e384c0bd1610ef0bb9f23399be7.tar.zst PeerTube-32b2b43c06621e384c0bd1610ef0bb9f23399be7.zip |
Update follower/following counts
Diffstat (limited to 'server/tests/api')
-rw-r--r-- | server/tests/api/server/follows.ts | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts index e6dfd5f62..27cf94985 100644 --- a/server/tests/api/server/follows.ts +++ b/server/tests/api/server/follows.ts | |||
@@ -12,6 +12,7 @@ import { | |||
12 | } from '../../utils/index' | 12 | } from '../../utils/index' |
13 | import { dateIsValid } from '../../utils/miscs/miscs' | 13 | import { dateIsValid } from '../../utils/miscs/miscs' |
14 | import { follow, getFollowersListPaginationAndSort, getFollowingListPaginationAndSort, unfollow } from '../../utils/server/follows' | 14 | import { follow, getFollowersListPaginationAndSort, getFollowingListPaginationAndSort, unfollow } from '../../utils/server/follows' |
15 | import { expectAccountFollows } from '../../utils/users/accounts' | ||
15 | import { userLogin } from '../../utils/users/login' | 16 | import { userLogin } from '../../utils/users/login' |
16 | import { createUser } from '../../utils/users/users' | 17 | import { createUser } from '../../utils/users/users' |
17 | import { | 18 | import { |
@@ -116,6 +117,19 @@ describe('Test follows', function () { | |||
116 | expect(follows.length).to.equal(0) | 117 | expect(follows.length).to.equal(0) |
117 | }) | 118 | }) |
118 | 119 | ||
120 | it('Should have the correct following counts', async function () { | ||
121 | await expectAccountFollows(servers[0].url, 'peertube@localhost:9001', 0, 2) | ||
122 | await expectAccountFollows(servers[0].url, 'peertube@localhost:9002', 1, 0) | ||
123 | await expectAccountFollows(servers[0].url, 'peertube@localhost:9003', 1, 0) | ||
124 | |||
125 | // Server 2 and 3 does not know server 1 follow another server (there was not a refresh) | ||
126 | await expectAccountFollows(servers[1].url, 'peertube@localhost:9001', 0, 1) | ||
127 | await expectAccountFollows(servers[1].url, 'peertube@localhost:9002', 1, 0) | ||
128 | |||
129 | await expectAccountFollows(servers[2].url, 'peertube@localhost:9001', 0, 1) | ||
130 | await expectAccountFollows(servers[2].url, 'peertube@localhost:9003', 1, 0) | ||
131 | }) | ||
132 | |||
119 | it('Should unfollow server 3 on server 1', async function () { | 133 | it('Should unfollow server 3 on server 1', async function () { |
120 | this.timeout(5000) | 134 | this.timeout(5000) |
121 | 135 | ||
@@ -144,6 +158,17 @@ describe('Test follows', function () { | |||
144 | expect(follows.length).to.equal(0) | 158 | expect(follows.length).to.equal(0) |
145 | }) | 159 | }) |
146 | 160 | ||
161 | it('Should have the correct following counts 2', async function () { | ||
162 | await expectAccountFollows(servers[0].url, 'peertube@localhost:9001', 0, 1) | ||
163 | await expectAccountFollows(servers[0].url, 'peertube@localhost:9002', 1, 0) | ||
164 | |||
165 | await expectAccountFollows(servers[1].url, 'peertube@localhost:9001', 0, 1) | ||
166 | await expectAccountFollows(servers[1].url, 'peertube@localhost:9002', 1, 0) | ||
167 | |||
168 | await expectAccountFollows(servers[2].url, 'peertube@localhost:9001', 0, 0) | ||
169 | await expectAccountFollows(servers[2].url, 'peertube@localhost:9003', 0, 0) | ||
170 | }) | ||
171 | |||
147 | it('Should upload a video on server 2 ans 3 and propagate only the video of server 2', async function () { | 172 | it('Should upload a video on server 2 ans 3 and propagate only the video of server 2', async function () { |
148 | this.timeout(10000) | 173 | this.timeout(10000) |
149 | 174 | ||
@@ -223,6 +248,18 @@ describe('Test follows', function () { | |||
223 | await wait(7000) | 248 | await wait(7000) |
224 | }) | 249 | }) |
225 | 250 | ||
251 | it('Should have the correct following counts 2', async function () { | ||
252 | await expectAccountFollows(servers[0].url, 'peertube@localhost:9001', 0, 2) | ||
253 | await expectAccountFollows(servers[0].url, 'peertube@localhost:9002', 1, 0) | ||
254 | await expectAccountFollows(servers[0].url, 'peertube@localhost:9003', 1, 0) | ||
255 | |||
256 | await expectAccountFollows(servers[1].url, 'peertube@localhost:9001', 0, 1) | ||
257 | await expectAccountFollows(servers[1].url, 'peertube@localhost:9002', 1, 0) | ||
258 | |||
259 | await expectAccountFollows(servers[2].url, 'peertube@localhost:9001', 0, 1) | ||
260 | await expectAccountFollows(servers[2].url, 'peertube@localhost:9003', 1, 0) | ||
261 | }) | ||
262 | |||
226 | it('Should propagate videos', async function () { | 263 | it('Should propagate videos', async function () { |
227 | const res = await getVideosList(servers[ 0 ].url) | 264 | const res = await getVideosList(servers[ 0 ].url) |
228 | expect(res.body.total).to.equal(7) | 265 | expect(res.body.total).to.equal(7) |