mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Added test helper for admin api v2: getValidAdminKey
no issue
This commit is contained in:
parent
f82bb07534
commit
fbe2829b93
1 changed files with 16 additions and 0 deletions
|
@ -99,5 +99,21 @@ module.exports = {
|
||||||
|
|
||||||
doAuth(...args) {
|
doAuth(...args) {
|
||||||
return testUtils.API.doAuth(`${API_URL}session/`, ...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…
Add table
Reference in a new issue