mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-27 04:43:12 +03:00
34 lines
818 B
JavaScript
34 lines
818 B
JavaScript
|
const TestAgent = require('./test-agent');
|
||
|
const DataGenerator = require('./fixtures/data-generator');
|
||
|
|
||
|
const defaultContentAPISecretKey = DataGenerator.Content.api_keys[1].secret;
|
||
|
|
||
|
/**
|
||
|
* @constructor
|
||
|
* @param {Object} app Ghost express app instance
|
||
|
* @param {Object} options
|
||
|
* @param {String} options.apiURL
|
||
|
* @param {String} options.originURL
|
||
|
*/
|
||
|
class ContentAPITestAgent extends TestAgent {
|
||
|
constructor(app, options) {
|
||
|
super(app, options);
|
||
|
}
|
||
|
|
||
|
async authenticateWithSecret(secret) {
|
||
|
this.defaults.queryParams = {
|
||
|
key: secret
|
||
|
};
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
* @description Authenticate with default content api keys
|
||
|
*/
|
||
|
authenticate() {
|
||
|
return this.authenticateWithSecret(defaultContentAPISecretKey);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = ContentAPITestAgent;
|