Ghost/ghost/core/test/utils/agents/content-api-test-agent.js
Hannah Wolfe 409a4783a3
Renamed content api agent auth method
- the query param is called key, so key is easier to remember
2022-09-02 10:48:03 +01:00

34 lines
802 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 authenticateWithKey(key) {
this.defaults.queryParams = {
key
};
}
/**
*
* @description Authenticate with default content api keys
*/
authenticate() {
return this.authenticateWithKey(defaultContentAPISecretKey);
}
}
module.exports = ContentAPITestAgent;