Ghost/ghost/core/test/utils/agents/content-api-test-agent.js
Daniel Lockyer 4b5b3de11c
Moved test agents into subfolder
- these agent files are all very similar and should be grouped together
- moving them into a subfolder makes the `test/utils` folder a little
  bit easier to browse
2022-07-26 18:00:37 +02:00

34 lines
819 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;