2022-02-22 06:54:06 +03:00
|
|
|
const TestAgent = require('./test-agent');
|
2022-07-26 19:00:37 +03:00
|
|
|
const DataGenerator = require('../fixtures/data-generator');
|
2022-02-22 06:54:06 +03:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2022-09-02 12:48:03 +03:00
|
|
|
async authenticateWithKey(key) {
|
2022-02-22 06:54:06 +03:00
|
|
|
this.defaults.queryParams = {
|
2022-09-02 12:48:03 +03:00
|
|
|
key
|
2022-02-22 06:54:06 +03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @description Authenticate with default content api keys
|
|
|
|
*/
|
|
|
|
authenticate() {
|
2022-09-02 12:48:03 +03:00
|
|
|
return this.authenticateWithKey(defaultContentAPISecretKey);
|
2022-02-22 06:54:06 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = ContentAPITestAgent;
|