diff options
Diffstat (limited to 'server/tests/utils')
-rw-r--r-- | server/tests/utils/follows.ts | 13 | ||||
-rw-r--r-- | server/tests/utils/index.ts | 1 | ||||
-rw-r--r-- | server/tests/utils/request-schedulers.ts | 20 |
3 files changed, 13 insertions, 21 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 | } |
diff --git a/server/tests/utils/index.ts b/server/tests/utils/index.ts index fe6d3b041..4308fd49a 100644 --- a/server/tests/utils/index.ts +++ b/server/tests/utils/index.ts | |||
@@ -4,7 +4,6 @@ export * from './config' | |||
4 | export * from './login' | 4 | export * from './login' |
5 | export * from './miscs' | 5 | export * from './miscs' |
6 | export * from './follows' | 6 | export * from './follows' |
7 | export * from './request-schedulers' | ||
8 | export * from './requests' | 7 | export * from './requests' |
9 | export * from './servers' | 8 | export * from './servers' |
10 | export * from './services' | 9 | export * from './services' |
diff --git a/server/tests/utils/request-schedulers.ts b/server/tests/utils/request-schedulers.ts deleted file mode 100644 index f100f6d99..000000000 --- a/server/tests/utils/request-schedulers.ts +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | import * as request from 'supertest' | ||
2 | |||
3 | import { ServerInfo } from '../utils' | ||
4 | |||
5 | function getRequestsStats (server: ServerInfo) { | ||
6 | const path = '/api/v1/request-schedulers/stats' | ||
7 | |||
8 | return request(server.url) | ||
9 | .get(path) | ||
10 | .set('Accept', 'application/json') | ||
11 | .set('Authorization', 'Bearer ' + server.accessToken) | ||
12 | .expect(200) | ||
13 | .expect('Content-Type', /json/) | ||
14 | } | ||
15 | |||
16 | // --------------------------------------------------------------------------- | ||
17 | |||
18 | export { | ||
19 | getRequestsStats | ||
20 | } | ||