-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
alban bertolini
authored and
alban bertolini
committed
Mar 8, 2024
1 parent
9ddd0db
commit a49ac73
Showing
3 changed files
with
9 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
const nock = require('nock'); | ||
const jwt = require('jsonwebtoken'); | ||
const ProjectSerializer = require('../../src/serializers/project'); | ||
const EnvironmentSerializer = require('../../src/serializers/environment'); | ||
const JobSerializer = require('../../src/serializers/job'); | ||
|
@@ -140,13 +139,15 @@ function authenticationFailed(scope) { | |
* @param {import('nock').Scope} scope | ||
*/ | ||
function authenticationSucceeded(scope) { | ||
const a = | ||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MDk5MDUwMTgsImV4cCI6MTcwOTk5MTQxOH0.EuQsuKhEGyEm4MXCZKMuFyk6V9bDM8wnrWcZ05mnp0c'; | ||
return scope | ||
.post( | ||
'/oidc/token', | ||
'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Adevice_code&device_code=DEVICE-CODE&client_id=the-client-id', | ||
) | ||
.reply(200, { | ||
access_token: jwt.sign({}, 'key', { expiresIn: '1day' }), | ||
access_token: a, | ||
}); | ||
} | ||
|
||
|
@@ -169,7 +170,8 @@ function createAuthenticationToken(scope) { | |
data: { | ||
id: 42, | ||
attributes: { | ||
token: jwt.sign({}, 'key', { expiresIn: '1day' }), | ||
token: | ||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MDk5MDUwMTgsImV4cCI6MTcwOTk5MTQxOH0.EuQsuKhEGyEm4MXCZKMuFyk6V9bDM8wnrWcZ05mnp0c', | ||
}, | ||
}, | ||
}); | ||
|
@@ -203,7 +205,10 @@ module.exports = { | |
loginValid: () => | ||
nock('http://localhost:3001') | ||
.post('/api/sessions', { email: '[email protected]', password: 'valid_pwd' }) | ||
.reply(200, { token: jwt.sign({}, 'key', { expiresIn: '1day' }) }), | ||
.reply(200, { | ||
token: | ||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MDk5MDUwMTgsImV4cCI6MTcwOTk5MTQxOH0.EuQsuKhEGyEm4MXCZKMuFyk6V9bDM8wnrWcZ05mnp0c', | ||
}), | ||
|
||
loginInvalid: () => | ||
nock('http://localhost:3001') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8065,11 +8065,6 @@ jws@^4.0.0: | |
jwa "^2.0.0" | ||
safe-buffer "^5.0.1" | ||
|
||
[email protected]: | ||
version "2.2.0" | ||
resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-2.2.0.tgz#7d86bd56679f58ce6a84704a657dd392bba81a79" | ||
integrity sha512-86GgN2vzfUu7m9Wcj63iUkuDzFNYFVmjeDm2GzWpUk+opB0pEpMsw6ePCMrhYkumz2C1ihqtZzOMAg7FiXcNoQ== | ||
|
||
keytar@^7.3.0: | ||
version "7.9.0" | ||
resolved "https://registry.yarnpkg.com/keytar/-/keytar-7.9.0.tgz#4c6225708f51b50cbf77c5aae81721964c2918cb" | ||
|