diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-21 13:43:29 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:52 +0100 |
commit | 0f91ae62df8a37194fea84ce1efa9e733d9c1fd8 (patch) | |
tree | 1cb0fccadebb629d02632dc8e21fae7ba521c464 /server/tests/utils/follows.ts | |
parent | 81de19482b89342c3dbc098a9f512ef7f1056e45 (diff) | |
download | PeerTube-0f91ae62df8a37194fea84ce1efa9e733d9c1fd8.tar.gz PeerTube-0f91ae62df8a37194fea84ce1efa9e733d9c1fd8.tar.zst PeerTube-0f91ae62df8a37194fea84ce1efa9e733d9c1fd8.zip |
Add follow tests
Diffstat (limited to 'server/tests/utils/follows.ts')
-rw-r--r-- | server/tests/utils/follows.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/server/tests/utils/follows.ts b/server/tests/utils/follows.ts index 618436b3c..b88776011 100644 --- a/server/tests/utils/follows.ts +++ b/server/tests/utils/follows.ts | |||
@@ -42,6 +42,18 @@ async function follow (follower: string, following: string[], accessToken: strin | |||
42 | return res | 42 | return res |
43 | } | 43 | } |
44 | 44 | ||
45 | async function unfollow (url: string, accessToken: string, id: number, expectedStatus = 204) { | ||
46 | const path = '/api/v1/server/following/' + id | ||
47 | |||
48 | const res = await request(url) | ||
49 | .delete(path) | ||
50 | .set('Accept', 'application/json') | ||
51 | .set('Authorization', 'Bearer ' + accessToken) | ||
52 | .expect(expectedStatus) | ||
53 | |||
54 | return res | ||
55 | } | ||
56 | |||
45 | async function doubleFollow (server1: ServerInfo, server2: ServerInfo) { | 57 | async function doubleFollow (server1: ServerInfo, server2: ServerInfo) { |
46 | await Promise.all([ | 58 | await Promise.all([ |
47 | follow(server1.url, [ server2.url ], server1.accessToken), | 59 | follow(server1.url, [ server2.url ], server1.accessToken), |
@@ -59,6 +71,7 @@ async function doubleFollow (server1: ServerInfo, server2: ServerInfo) { | |||
59 | export { | 71 | export { |
60 | getFollowersListPaginationAndSort, | 72 | getFollowersListPaginationAndSort, |
61 | getFollowingListPaginationAndSort, | 73 | getFollowingListPaginationAndSort, |
74 | unfollow, | ||
62 | follow, | 75 | follow, |
63 | doubleFollow | 76 | doubleFollow |
64 | } | 77 | } |