X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Futils%2Ffollows.ts;h=b88776011e590f4235782b60a806f101062305b1;hb=1f3e9feca2caf68024168b0ea9ed39d8438fa235;hp=cffc1648fac0ccd4a8a48eee2a67a12e32ca5bec;hpb=9a27cdc27c900feaae5f6db4315c4ccdfc0c4493;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/utils/follows.ts b/server/tests/utils/follows.ts index cffc1648f..b88776011 100644 --- a/server/tests/utils/follows.ts +++ b/server/tests/utils/follows.ts @@ -39,8 +39,17 @@ async function follow (follower: string, following: string[], accessToken: strin .send({ 'hosts': followingHosts }) .expect(expectedStatus) - // Wait request propagation - await wait(20000) + return res +} + +async function unfollow (url: string, accessToken: string, id: number, expectedStatus = 204) { + const path = '/api/v1/server/following/' + id + + const res = await request(url) + .delete(path) + .set('Accept', 'application/json') + .set('Authorization', 'Bearer ' + accessToken) + .expect(expectedStatus) return res } @@ -51,6 +60,9 @@ async function doubleFollow (server1: ServerInfo, server2: ServerInfo) { follow(server2.url, [ server1.url ], server2.accessToken) ]) + // Wait request propagation + await wait(20000) + return true } @@ -59,6 +71,7 @@ async function doubleFollow (server1: ServerInfo, server2: ServerInfo) { export { getFollowersListPaginationAndSort, getFollowingListPaginationAndSort, + unfollow, follow, doubleFollow }