mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 05:50:35 +03:00
Added test helper for admin api v2: getValidAdminKey
no issue
This commit is contained in:
parent
f82bb07534
commit
fbe2829b93
@ -99,5 +99,21 @@ module.exports = {
|
||||
|
||||
doAuth(...args) {
|
||||
return testUtils.API.doAuth(`${API_URL}session/`, ...args);
|
||||
},
|
||||
|
||||
getValidAdminKey(endpoint) {
|
||||
const jwt = require('jsonwebtoken');
|
||||
const JWT_OPTIONS = {
|
||||
algorithm: 'HS256'
|
||||
};
|
||||
|
||||
return jwt.sign(
|
||||
{
|
||||
kid: testUtils.DataGenerator.Content.api_keys[0].id
|
||||
},
|
||||
Buffer.from(testUtils.DataGenerator.Content.api_keys[0].secret, 'hex'),
|
||||
JWT_OPTIONS,
|
||||
endpoint
|
||||
);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user