mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-30 06:12:03 +03:00
182a7ea07c
closes: https://github.com/TryGhost/Ghost/issues/14980
refs: cc276486f0
- Tenor is now operated by Google, and the old v1 Tenor API has been decommissioned
- At present anyone with a pre-configured tenor integration will get intermittent errors, whilst it is impossible to setup a new tenor API integration
- Sadly old keys do not work with the new API, and new keys do not work with the old API, so there is no happy path forward.
- After this lands, everyone will need to go and get a new Google API Key for Tenor, update their config, and then the integration will work properly again.
- This particular change renames the API key from `publicReadOnlyApiKey` to `googleApiKey` to reflect that the key itself changes in type and behaviour
Co-authored-by: Hannah Wolfe <github.erisds@gmail.com>
70 lines
2.5 KiB
JavaScript
70 lines
2.5 KiB
JavaScript
const should = require('should');
|
|
const supertest = require('supertest');
|
|
const testUtils = require('../../utils');
|
|
const localUtils = require('./utils');
|
|
const config = require('../../../core/shared/config');
|
|
const configUtils = require('../../utils/configUtils');
|
|
|
|
describe('Config API', function () {
|
|
let request;
|
|
|
|
before(async function () {
|
|
await localUtils.startGhost();
|
|
request = supertest.agent(config.get('url'));
|
|
await localUtils.doAuth(request);
|
|
});
|
|
|
|
afterEach(function () {
|
|
configUtils.set('tenor:googleApiKey', undefined);
|
|
});
|
|
|
|
it('can retrieve config and all expected properties', async function () {
|
|
// set any non-default keys so we can be sure they're exposed
|
|
configUtils.set('tenor:googleApiKey', 'TENOR_KEY');
|
|
|
|
const res = await request
|
|
.get(localUtils.API.getApiQuery('config/'))
|
|
.set('Origin', config.get('url'))
|
|
.expect('Content-Type', /json/)
|
|
.expect('Cache-Control', testUtils.cacheRules.private)
|
|
.expect(200);
|
|
|
|
localUtils.API.checkResponse(res.body.config, 'config');
|
|
|
|
// full version
|
|
res.body.config.version.should.match(/\d+\.\d+\.\d+/);
|
|
});
|
|
|
|
describe('mailgunIsConfigured', function () {
|
|
it('is a boolean when it is configured', async function () {
|
|
// set any non-default keys so we can be sure they're exposed
|
|
configUtils.set('bulkEmail', {
|
|
mailgun: 'exists'
|
|
});
|
|
|
|
const res = await request
|
|
.get(localUtils.API.getApiQuery('config/'))
|
|
.set('Origin', config.get('url'))
|
|
.expect('Content-Type', /json/)
|
|
.expect('Cache-Control', testUtils.cacheRules.private)
|
|
.expect(200);
|
|
|
|
should.equal(typeof res.body.config.mailgunIsConfigured, 'boolean');
|
|
});
|
|
|
|
it('is a boolean when it is not configured', async function () {
|
|
// set any non-default keys so we can be sure they're exposed
|
|
configUtils.set('bulkEmail', {});
|
|
|
|
const res = await request
|
|
.get(localUtils.API.getApiQuery('config/'))
|
|
.set('Origin', config.get('url'))
|
|
.expect('Content-Type', /json/)
|
|
.expect('Cache-Control', testUtils.cacheRules.private)
|
|
.expect(200);
|
|
|
|
should.equal(typeof res.body.config.mailgunIsConfigured, 'boolean');
|
|
});
|
|
});
|
|
});
|