0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Enable Public API by default (#8600)

closes #8601 

- this doesn't take the feature out of beta, but does enable it by default
- no need to enable the public api in the test anymore
- because public api is enabled by default
This commit is contained in:
Hannah Wolfe 2017-06-20 04:10:49 +01:00 committed by Aileen Nowak
parent c3dbd0e56b
commit 2058127dc5
2 changed files with 5 additions and 23 deletions

View file

@ -73,7 +73,7 @@
"defaultValue" : "" "defaultValue" : ""
}, },
"labs": { "labs": {
"defaultValue": "{}" "defaultValue": "{\"publicAPI\": true}"
}, },
"navigation": { "navigation": {
"defaultValue": "[{\"label\":\"Home\", \"url\":\"/\"}]" "defaultValue": "[{\"label\":\"Home\", \"url\":\"/\"}]"

View file

@ -7,37 +7,19 @@ var should = require('should'),
request; request;
describe('Public API', function () { describe('Public API', function () {
var publicAPIaccessSetting = { var ghostServer;
settings: [
{key: 'labs', value: {publicAPI: true}}
]
}, ghostServer;
before(function (done) { before(function () {
// starting ghost automatically populates the db // starting ghost automatically populates the db
// TODO: prevent db init, and manage bringing up the DB with fixtures ourselves // TODO: prevent db init, and manage bringing up the DB with fixtures ourselves
ghost().then(function (_ghostServer) { return ghost().then(function (_ghostServer) {
ghostServer = _ghostServer; ghostServer = _ghostServer;
return ghostServer.start(); return ghostServer.start();
}).then(function () { }).then(function () {
request = supertest.agent(config.get('url')); request = supertest.agent(config.get('url'));
}).then(function () { }).then(function () {
return testUtils.doAuth(request, 'posts', 'tags', 'client:trusted-domain'); return testUtils.doAuth(request, 'posts', 'tags', 'client:trusted-domain');
}).then(function (token) { });
// enable public API
request.put(testUtils.API.getApiQuery('settings/'))
.set('Authorization', 'Bearer ' + token)
.send(publicAPIaccessSetting)
.expect('Content-Type', /json/)
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(200)
.end(function (err) {
if (err) {
return done(err);
}
done();
});
}).catch(done);
}); });
after(function () { after(function () {