mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-01 07:16:52 +03:00
Removed use of ghostServer variable pattern
refs https://github.com/TryGhost/Toolbox/issues/138 - There is no good reason to keep this extra variable around just call "stop" in couple very specific cases. Even for those cases, there's `testUtils.stopGhost` method which achieves the same without additional variable to track.
This commit is contained in:
parent
8dd33c5034
commit
231cfef086
@ -10,16 +10,15 @@ const labs = require('../../../core/shared/labs');
|
|||||||
|
|
||||||
describe('Settings API', function () {
|
describe('Settings API', function () {
|
||||||
let request;
|
let request;
|
||||||
let ghostServer;
|
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
ghostServer = await localUtils.startGhost();
|
await localUtils.startGhost();
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
await localUtils.doAuth(request);
|
await localUtils.doAuth(request);
|
||||||
});
|
});
|
||||||
|
|
||||||
after(function () {
|
after(function () {
|
||||||
return ghostServer.stop();
|
return testUtils.stopGhost();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can request all settings', async function () {
|
it('Can request all settings', async function () {
|
||||||
@ -262,6 +261,6 @@ describe('Settings API', function () {
|
|||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
res.headers['x-cache-invalidate'].should.eql('/*');
|
res.headers['x-cache-invalidate'].should.eql('/*');
|
||||||
await ghostServer.stop();
|
await testUtils.stopGhost();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -12,13 +12,10 @@ const mailService = require('../../../../../core/server/services/mail/index');
|
|||||||
let request;
|
let request;
|
||||||
|
|
||||||
describe('Authentication API v3', function () {
|
describe('Authentication API v3', function () {
|
||||||
let ghostServer;
|
|
||||||
|
|
||||||
describe('Blog setup', function () {
|
describe('Blog setup', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost({forceStart: true})
|
return testUtils.startGhost({forceStart: true})
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -139,8 +136,7 @@ describe('Authentication API v3', function () {
|
|||||||
describe('Invitation', function () {
|
describe('Invitation', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
|
|
||||||
// simulates blog setup (initialises the owner)
|
// simulates blog setup (initialises the owner)
|
||||||
|
@ -71,7 +71,7 @@ describe('Identities API', function () {
|
|||||||
describe('As non-Owner', function () {
|
describe('As non-Owner', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -87,7 +87,7 @@ describe('Members Sigin URL API', function () {
|
|||||||
describe('As non-Owner and non-Admin', function () {
|
describe('As non-Owner and non-Admin', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -10,7 +10,7 @@ describe('Notifications API', function () {
|
|||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -70,7 +70,7 @@ describe('Notifications API', function () {
|
|||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -118,7 +118,7 @@ describe('Notifications API', function () {
|
|||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
requestEditor1 = supertest.agent(config.get('url'));
|
requestEditor1 = supertest.agent(config.get('url'));
|
||||||
requestEditor2 = supertest.agent(config.get('url'));
|
requestEditor2 = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
|
@ -8,7 +8,7 @@ let request;
|
|||||||
describe('Pages API', function () {
|
describe('Pages API', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -437,14 +437,12 @@ const defaultSettingsKeyTypes = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
describe('Settings API (canary)', function () {
|
describe('Settings API (canary)', function () {
|
||||||
let ghostServer;
|
|
||||||
let request;
|
let request;
|
||||||
|
|
||||||
describe('As Owner', function () {
|
describe('As Owner', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -1270,9 +1268,8 @@ describe('Settings API (canary)', function () {
|
|||||||
describe('As Admin', function () {
|
describe('As Admin', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
request = supertest.agent(config.get('url'));
|
||||||
request = supertest.agent(config.get('url'));
|
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
// create admin
|
// create admin
|
||||||
@ -1295,8 +1292,7 @@ describe('Settings API (canary)', function () {
|
|||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -1356,8 +1352,7 @@ describe('Settings API (canary)', function () {
|
|||||||
describe('As Author', function () {
|
describe('As Author', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -9,12 +9,9 @@ const events = require('../../../../../core/server/lib/common/events');
|
|||||||
let request;
|
let request;
|
||||||
|
|
||||||
describe('Slack API', function () {
|
describe('Slack API', function () {
|
||||||
let ghostServer;
|
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -9,15 +9,13 @@ let request;
|
|||||||
describe('User API', function () {
|
describe('User API', function () {
|
||||||
let editor;
|
let editor;
|
||||||
let author;
|
let author;
|
||||||
let ghostServer;
|
|
||||||
let otherAuthor;
|
let otherAuthor;
|
||||||
let admin;
|
let admin;
|
||||||
|
|
||||||
describe('As Owner', function () {
|
describe('As Owner', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -149,8 +147,7 @@ describe('User API', function () {
|
|||||||
describe('As Editor', function () {
|
describe('As Editor', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -229,8 +226,7 @@ describe('User API', function () {
|
|||||||
describe('As Author', function () {
|
describe('As Author', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -11,7 +11,7 @@ describe('Authors Content API', function () {
|
|||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -13,13 +13,10 @@ const configUtils = require('../../../../utils/configUtils');
|
|||||||
let request;
|
let request;
|
||||||
|
|
||||||
describe('Authentication API v2', function () {
|
describe('Authentication API v2', function () {
|
||||||
let ghostServer;
|
|
||||||
|
|
||||||
describe('Blog setup: default config', function () {
|
describe('Blog setup: default config', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost({forceStart: true})
|
return testUtils.startGhost({forceStart: true})
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -138,8 +135,7 @@ describe('Authentication API v2', function () {
|
|||||||
describe('Blog setup: custom config', function () {
|
describe('Blog setup: custom config', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost({forceStart: true})
|
return testUtils.startGhost({forceStart: true})
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -261,8 +257,7 @@ describe('Authentication API v2', function () {
|
|||||||
describe('Invitation', function () {
|
describe('Invitation', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
|
|
||||||
// simulates blog setup (initialises the owner)
|
// simulates blog setup (initialises the owner)
|
||||||
|
@ -10,7 +10,7 @@ describe('Notifications API', function () {
|
|||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -70,7 +70,7 @@ describe('Notifications API', function () {
|
|||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -118,7 +118,7 @@ describe('Notifications API', function () {
|
|||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
requestEditor1 = supertest.agent(config.get('url'));
|
requestEditor1 = supertest.agent(config.get('url'));
|
||||||
requestEditor2 = supertest.agent(config.get('url'));
|
requestEditor2 = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
|
@ -10,13 +10,11 @@ const localUtils = require('./utils');
|
|||||||
const dnsPromises = require('dns').promises;
|
const dnsPromises = require('dns').promises;
|
||||||
|
|
||||||
describe('Oembed API (v2)', function () {
|
describe('Oembed API (v2)', function () {
|
||||||
let ghostServer;
|
|
||||||
let request;
|
let request;
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then((_ghostServer) => {
|
.then(() => {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -8,7 +8,7 @@ let request;
|
|||||||
describe('Pages API', function () {
|
describe('Pages API', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -91,14 +91,12 @@ const defaultSettingsKeyTypes = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
describe('Settings API (v2)', function () {
|
describe('Settings API (v2)', function () {
|
||||||
let ghostServer;
|
|
||||||
let request;
|
let request;
|
||||||
|
|
||||||
describe('As Owner', function () {
|
describe('As Owner', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -729,8 +727,7 @@ describe('Settings API (v2)', function () {
|
|||||||
describe('As Admin', function () {
|
describe('As Admin', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -754,8 +751,7 @@ describe('Settings API (v2)', function () {
|
|||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -815,8 +811,7 @@ describe('Settings API (v2)', function () {
|
|||||||
describe('As Author', function () {
|
describe('As Author', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -9,12 +9,9 @@ const events = require('../../../../../core/server/lib/common/events');
|
|||||||
let request;
|
let request;
|
||||||
|
|
||||||
describe('Slack API', function () {
|
describe('Slack API', function () {
|
||||||
let ghostServer;
|
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -9,15 +9,13 @@ let request;
|
|||||||
describe('User API', function () {
|
describe('User API', function () {
|
||||||
let editor;
|
let editor;
|
||||||
let author;
|
let author;
|
||||||
let ghostServer;
|
|
||||||
let otherAuthor;
|
let otherAuthor;
|
||||||
let admin;
|
let admin;
|
||||||
|
|
||||||
describe('As Owner', function () {
|
describe('As Owner', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -149,8 +147,7 @@ describe('User API', function () {
|
|||||||
describe('As Editor', function () {
|
describe('As Editor', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -229,8 +226,7 @@ describe('User API', function () {
|
|||||||
describe('As Author', function () {
|
describe('As Author', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -11,7 +11,7 @@ describe('Authors Content API', function () {
|
|||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -12,13 +12,10 @@ const mailService = require('../../../../../core/server/services/mail/index');
|
|||||||
let request;
|
let request;
|
||||||
|
|
||||||
describe('Authentication API v3', function () {
|
describe('Authentication API v3', function () {
|
||||||
let ghostServer;
|
|
||||||
|
|
||||||
describe('Blog setup', function () {
|
describe('Blog setup', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost({forceStart: true})
|
return testUtils.startGhost({forceStart: true})
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -138,8 +135,7 @@ describe('Authentication API v3', function () {
|
|||||||
describe('Invitation', function () {
|
describe('Invitation', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
|
|
||||||
// simulates blog setup (initialises the owner)
|
// simulates blog setup (initialises the owner)
|
||||||
|
@ -71,7 +71,7 @@ describe('Identities API', function () {
|
|||||||
describe('As non-Owner', function () {
|
describe('As non-Owner', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -87,7 +87,7 @@ describe('Members Sigin URL API', function () {
|
|||||||
describe('As non-Owner and non-Admin', function () {
|
describe('As non-Owner and non-Admin', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -10,7 +10,7 @@ describe('Notifications API', function () {
|
|||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -70,7 +70,7 @@ describe('Notifications API', function () {
|
|||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -118,7 +118,7 @@ describe('Notifications API', function () {
|
|||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
requestEditor1 = supertest.agent(config.get('url'));
|
requestEditor1 = supertest.agent(config.get('url'));
|
||||||
requestEditor2 = supertest.agent(config.get('url'));
|
requestEditor2 = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
|
@ -8,7 +8,7 @@ let request;
|
|||||||
describe('Pages API', function () {
|
describe('Pages API', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -95,14 +95,12 @@ const defaultSettingsKeyTypes = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
describe('Settings API (v3)', function () {
|
describe('Settings API (v3)', function () {
|
||||||
let ghostServer;
|
|
||||||
let request;
|
let request;
|
||||||
|
|
||||||
describe('As Owner', function () {
|
describe('As Owner', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -723,8 +721,7 @@ describe('Settings API (v3)', function () {
|
|||||||
describe('As Admin', function () {
|
describe('As Admin', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -748,8 +745,7 @@ describe('Settings API (v3)', function () {
|
|||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -809,8 +805,7 @@ describe('Settings API (v3)', function () {
|
|||||||
describe('As Author', function () {
|
describe('As Author', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -9,12 +9,9 @@ const events = require('../../../../../core/server/lib/common/events');
|
|||||||
let request;
|
let request;
|
||||||
|
|
||||||
describe('Slack API', function () {
|
describe('Slack API', function () {
|
||||||
let ghostServer;
|
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -9,15 +9,13 @@ let request;
|
|||||||
describe('User API', function () {
|
describe('User API', function () {
|
||||||
let editor;
|
let editor;
|
||||||
let author;
|
let author;
|
||||||
let ghostServer;
|
|
||||||
let otherAuthor;
|
let otherAuthor;
|
||||||
let admin;
|
let admin;
|
||||||
|
|
||||||
describe('As Owner', function () {
|
describe('As Owner', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -149,8 +147,7 @@ describe('User API', function () {
|
|||||||
describe('As Editor', function () {
|
describe('As Editor', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
@ -229,8 +226,7 @@ describe('User API', function () {
|
|||||||
describe('As Author', function () {
|
describe('As Author', function () {
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -11,7 +11,7 @@ describe('Authors Content API', function () {
|
|||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
@ -18,8 +18,6 @@ const settingsCache = require('../../../core/shared/settings-cache');
|
|||||||
let request;
|
let request;
|
||||||
|
|
||||||
describe('Dynamic Routing', function () {
|
describe('Dynamic Routing', function () {
|
||||||
let ghostServer;
|
|
||||||
|
|
||||||
function doEnd(done) {
|
function doEnd(done) {
|
||||||
return function (err, res) {
|
return function (err, res) {
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -47,8 +45,7 @@ describe('Dynamic Routing', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return testUtils.startGhost()
|
return testUtils.startGhost()
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -290,8 +287,7 @@ describe('Dynamic Routing', function () {
|
|||||||
configUtils.set('admin:redirects', false);
|
configUtils.set('admin:redirects', false);
|
||||||
|
|
||||||
return testUtils.startGhost({forceStart: true})
|
return testUtils.startGhost({forceStart: true})
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -300,8 +296,7 @@ describe('Dynamic Routing', function () {
|
|||||||
configUtils.restore();
|
configUtils.restore();
|
||||||
|
|
||||||
return testUtils.startGhost({forceStart: true})
|
return testUtils.startGhost({forceStart: true})
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -486,8 +481,7 @@ describe('Dynamic Routing', function () {
|
|||||||
configUtils.set('admin:redirects', false);
|
configUtils.set('admin:redirects', false);
|
||||||
|
|
||||||
return testUtils.startGhost({forceStart: true})
|
return testUtils.startGhost({forceStart: true})
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -496,8 +490,7 @@ describe('Dynamic Routing', function () {
|
|||||||
configUtils.restore();
|
configUtils.restore();
|
||||||
|
|
||||||
return testUtils.startGhost({forceStart: true})
|
return testUtils.startGhost({forceStart: true})
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(config.get('url'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -616,7 +609,7 @@ describe('Dynamic Routing', function () {
|
|||||||
|
|
||||||
after(testUtils.teardownDb);
|
after(testUtils.teardownDb);
|
||||||
after(function () {
|
after(function () {
|
||||||
return ghostServer.stop();
|
return testUtils.stopGhost();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('confirm current routing pattern', function (done) {
|
it('confirm current routing pattern', function (done) {
|
||||||
|
@ -54,15 +54,12 @@ describe('Frontend Routing:Redirects', function () {
|
|||||||
|
|
||||||
redirectsFileExts.forEach((ext) => {
|
redirectsFileExts.forEach((ext) => {
|
||||||
describe(`Redirects (use redirects${ext} from test/utils/fixtures/data)`, function () {
|
describe(`Redirects (use redirects${ext} from test/utils/fixtures/data)`, function () {
|
||||||
let ghostServer;
|
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
configUtils.set('url', 'http://localhost:2370/');
|
configUtils.set('url', 'http://localhost:2370/');
|
||||||
urlUtils.stubUrlUtilsFromConfig();
|
urlUtils.stubUrlUtilsFromConfig();
|
||||||
|
|
||||||
return testUtils.startGhost({forceStart: true, redirectsFileExt: ext})
|
return testUtils.startGhost({forceStart: true, redirectsFileExt: ext})
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('server:host') + ':' + config.get('server:port'));
|
request = supertest.agent(config.get('server:host') + ':' + config.get('server:port'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -340,15 +337,12 @@ describe('Frontend Routing:Redirects', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe(`Subdirectory redirects (use redirects${ext} from test/utils/fixtures/data)`, function () {
|
describe(`Subdirectory redirects (use redirects${ext} from test/utils/fixtures/data)`, function () {
|
||||||
var ghostServer;
|
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
configUtils.set('url', 'http://localhost:2370/blog/');
|
configUtils.set('url', 'http://localhost:2370/blog/');
|
||||||
urlUtils.stubUrlUtilsFromConfig();
|
urlUtils.stubUrlUtilsFromConfig();
|
||||||
|
|
||||||
return testUtils.startGhost({forceStart: true, subdir: true, redirectsFileExt: ext})
|
return testUtils.startGhost({forceStart: true, subdir: true, redirectsFileExt: ext})
|
||||||
.then(function (_ghostServer) {
|
.then(function () {
|
||||||
ghostServer = _ghostServer;
|
|
||||||
request = supertest.agent(config.get('server:host') + ':' + config.get('server:port'));
|
request = supertest.agent(config.get('server:host') + ':' + config.get('server:port'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user