Added test helper for admin api v2: getValidAdminKey

no issue
This commit is contained in:
kirrg001 2019-01-18 17:36:11 +01:00
parent f82bb07534
commit fbe2829b93

View File

@ -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
);
}
};