]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/tests/utils/login.js
3 const request
= require('supertest')
7 loginAndGetAccessToken: loginAndGetAccessToken
10 // ---------------------- Export functions --------------------
12 function login (url
, client
, user
, expectedStatus
, end
) {
18 const path
= '/api/v1/users/token'
22 client_secret: client
.secret
,
23 username: user
.username
,
24 password: user
.password
,
25 response_type: 'code',
26 grant_type: 'password',
34 .expect(expectedStatus
)
38 function loginAndGetAccessToken (server
, callback
) {
39 login(server
.url
, server
.client
, server
.user
, 200, function (err
, res
) {
40 if (err
) return callback(err
)
42 return callback(null, res
.body
.access_token
)
46 // ---------------------------------------------------------------------------
48 module
.exports
= loginUtils