aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/users/login.ts
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils/users/login.ts')
-rw-r--r--shared/extra-utils/users/login.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/shared/extra-utils/users/login.ts b/shared/extra-utils/users/login.ts
index 4fe54a74a..2d68337a6 100644
--- a/shared/extra-utils/users/login.ts
+++ b/shared/extra-utils/users/login.ts
@@ -27,6 +27,16 @@ function login (url: string, client: Client, user: User, expectedStatus = 200) {
27 .expect(expectedStatus) 27 .expect(expectedStatus)
28} 28}
29 29
30function logout (url: string, token: string, expectedStatus = 200) {
31 const path = '/api/v1/users/revoke-token'
32
33 return request(url)
34 .post(path)
35 .set('Authorization', 'Bearer ' + token)
36 .type('form')
37 .expect(expectedStatus)
38}
39
30async function serverLogin (server: Server) { 40async function serverLogin (server: Server) {
31 const res = await login(server.url, server.client, server.user, 200) 41 const res = await login(server.url, server.client, server.user, 200)
32 42
@@ -71,6 +81,7 @@ function setAccessTokensToServers (servers: ServerInfo[]) {
71 81
72export { 82export {
73 login, 83 login,
84 logout,
74 serverLogin, 85 serverLogin,
75 userLogin, 86 userLogin,
76 getAccessToken, 87 getAccessToken,