Switched API regression tests to use frontendless boot

refs https://github.com/TryGhost/Toolbox/issues/138

- The boot oprimization gives a boost in the boot time, which should save time running regression tests
This commit is contained in:
Naz 2021-11-24 17:29:45 +04:00 committed by naz
parent 222273b66b
commit ac3b2e5aee
66 changed files with 149 additions and 95 deletions

View File

@ -14,7 +14,7 @@ let request;
describe('Authentication API v3', function () {
describe('Blog setup', function () {
before(async function () {
await testUtils.startGhost({forceStart: true});
await localUtils.startGhost({forceStart: true});
request = supertest.agent(config.get('url'));
});
@ -133,7 +133,7 @@ describe('Authentication API v3', function () {
describe('Invitation', function () {
before(function () {
return testUtils.startGhost()
return localUtils.startGhost()
.then(function () {
request = supertest.agent(config.get('url'));
@ -228,7 +228,7 @@ describe('Authentication API v3', function () {
const user = testUtils.DataGenerator.forModel.users[0];
before(function () {
return testUtils.startGhost({forceStart: true})
return localUtils.startGhost({forceStart: true})
.then(() => {
request = supertest.agent(config.get('url'));
})
@ -394,7 +394,7 @@ describe('Authentication API v3', function () {
describe('Reset all passwords', function () {
let sendEmail;
before(function () {
return testUtils.startGhost({forceStart: true})
return localUtils.startGhost({forceStart: true})
.then(() => {
request = supertest.agent(config.get('url'));
})

View File

@ -19,7 +19,7 @@ describe('DB API (canary)', function () {
let schedulerKey;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
backupKey = _.find(testUtils.getExistingData().apiKeys, {integration: {slug: 'ghost-backup'}});

View File

@ -33,7 +33,7 @@ const verifyJWKS = (endpoint, token) => {
describe('Identities API', function () {
describe('As Owner', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
});
@ -66,7 +66,7 @@ describe('Identities API', function () {
describe('As non-Owner', function () {
before(function () {
return testUtils.startGhost()
return localUtils.startGhost()
.then(function () {
request = supertest.agent(config.get('url'));
})

View File

@ -11,7 +11,7 @@ describe('Images API', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
});

View File

@ -14,7 +14,7 @@ describe('Labels API', function () {
});
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
});

View File

@ -21,7 +21,7 @@ describe('Members API (canary)', function () {
});
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request, 'members');
});

View File

@ -20,7 +20,7 @@ describe('Members Sigin URL API', function () {
describe('As Owner', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request, 'member');
});
@ -45,7 +45,7 @@ describe('Members Sigin URL API', function () {
describe('As Admin', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
const admin = await testUtils.createUser({
user: testUtils.DataGenerator.forKnex.createUser({email: 'admin+1@ghost.org'}),
@ -76,7 +76,7 @@ describe('Members Sigin URL API', function () {
describe('As non-Owner and non-Admin', function () {
before(function () {
return testUtils.startGhost()
return localUtils.startGhost()
.then(function () {
request = supertest.agent(config.get('url'));
})

View File

@ -9,7 +9,7 @@ describe('Notifications API', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
const user = await testUtils.createUser({
user: testUtils.DataGenerator.forKnex.createUser({
@ -64,7 +64,7 @@ describe('Notifications API', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
const user = await testUtils.createUser({
@ -107,7 +107,7 @@ describe('Notifications API', function () {
let notification;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
requestEditor1 = supertest.agent(config.get('url'));
requestEditor2 = supertest.agent(config.get('url'));

View File

@ -7,7 +7,7 @@ let request;
describe('Pages API', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request, 'posts');
});

View File

@ -12,7 +12,7 @@ describe('Posts API (canary)', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request, 'users:extra', 'posts', 'emails', 'members');
});

View File

@ -13,7 +13,7 @@ let request;
describe('Redirects API', function () {
const startGhost = async (options) => {
await testUtils.startGhost(options);
await localUtils.startGhost(options);
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
};

View File

@ -26,7 +26,7 @@ describe('Canary Schedules API', function () {
});
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));

View File

@ -441,7 +441,7 @@ describe('Settings API (canary)', function () {
describe('As Owner', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
});
@ -1263,7 +1263,7 @@ describe('Settings API (canary)', function () {
describe('As Admin', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create admin
@ -1279,7 +1279,7 @@ describe('Settings API (canary)', function () {
describe('As Editor', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create editor
request.user = await testUtils.createUser({
@ -1331,7 +1331,7 @@ describe('Settings API (canary)', function () {
describe('As Author', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create author

View File

@ -8,7 +8,7 @@ describe('Config API', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
});

View File

@ -10,7 +10,7 @@ let request;
describe('Slack API', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
});

View File

@ -11,7 +11,7 @@ describe('User API', function () {
let otherAuthor;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create inactive user
@ -130,7 +130,7 @@ describe('User API', function () {
let editor;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create editor
editor = await testUtils.createUser({
@ -204,7 +204,7 @@ describe('User API', function () {
let author;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create author
author = await testUtils.createUser({

View File

@ -204,6 +204,15 @@ module.exports = {
return testUtils.API.doAuth(`${API_URL}session/`, ...args);
},
async startGhost(overrides = {}) {
const defaults = {
backend: true,
frontend: false
};
return await testUtils.startGhost(Object.assign(defaults, overrides));
},
getValidAdminToken(endpoint, key) {
const jwt = require('jsonwebtoken');
key = key || testUtils.DataGenerator.Content.api_keys[0];

View File

@ -9,7 +9,7 @@ describe('Webhooks API (canary)', function () {
const API_VERSION = 'canary';
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));

View File

@ -10,7 +10,7 @@ describe('Authors Content API', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await testUtils.initFixtures('owner:post', 'users:no-owner', 'user:inactive', 'posts', 'api_keys');
});

View File

@ -11,7 +11,7 @@ describe('api/canary/content/pages', function () {
const key = localUtils.getValidKey();
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await testUtils.initFixtures('users:no-owner', 'user:inactive', 'posts', 'tags:extra', 'api_keys');
});

View File

@ -14,7 +14,7 @@ describe('api/canary/content/posts', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await testUtils.initFixtures('users:no-owner', 'user:inactive', 'posts', 'tags:extra', 'api_keys');
});

View File

@ -12,7 +12,7 @@ describe('api/canary/content/tags', function () {
const validKey = localUtils.getValidKey();
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await testUtils.initFixtures('users:no-owner', 'user:inactive', 'posts', 'tags:extra', 'api_keys');
});

View File

@ -100,5 +100,14 @@ module.exports = {
},
getValidKey() {
return testUtils.DataGenerator.Content.api_keys[1].secret;
},
async startGhost(overrides = {}) {
const defaults = {
backend: true,
frontend: false
};
return await testUtils.startGhost(Object.assign(defaults, overrides));
}
};

View File

@ -15,7 +15,7 @@ let request;
describe('Authentication API v2', function () {
describe('Blog setup: default config', function () {
before(async function () {
await testUtils.startGhost({forceStart: true});
await localUtils.startGhost({forceStart: true});
request = supertest.agent(config.get('url'));
});
@ -132,7 +132,7 @@ describe('Authentication API v2', function () {
describe('Blog setup: custom config', function () {
before(async function () {
await testUtils.startGhost({forceStart: true});
await localUtils.startGhost({forceStart: true});
request = supertest.agent(config.get('url'));
});
@ -252,7 +252,7 @@ describe('Authentication API v2', function () {
describe('Invitation', function () {
before(function () {
return testUtils.startGhost()
return localUtils.startGhost()
.then(function () {
request = supertest.agent(config.get('url'));
@ -331,7 +331,7 @@ describe('Authentication API v2', function () {
const user = testUtils.DataGenerator.forModel.users[0];
before(function () {
return testUtils.startGhost({forceStart: true})
return localUtils.startGhost({forceStart: true})
.then(() => {
request = supertest.agent(config.get('url'));
})

View File

@ -19,7 +19,7 @@ describe('DB API (v2)', function () {
let schedulerKey;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
backupKey = _.find(testUtils.getExistingData().apiKeys, {integration: {slug: 'ghost-backup'}});

View File

@ -11,7 +11,7 @@ describe('Images API', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
});

View File

@ -9,7 +9,7 @@ describe('Notifications API', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
const user = await testUtils.createUser({
user: testUtils.DataGenerator.forKnex.createUser({
@ -64,7 +64,7 @@ describe('Notifications API', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
const user = await testUtils.createUser({
@ -107,7 +107,7 @@ describe('Notifications API', function () {
let notification;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
requestEditor1 = supertest.agent(config.get('url'));
requestEditor2 = supertest.agent(config.get('url'));

View File

@ -13,7 +13,7 @@ describe('Oembed API (v2)', function () {
let request;
before(function () {
return testUtils.startGhost()
return localUtils.startGhost()
.then(() => {
request = supertest.agent(config.get('url'));
})

View File

@ -7,7 +7,7 @@ let request;
describe('Pages API', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request, 'posts');
});

View File

@ -12,7 +12,7 @@ describe('Posts API (v2)', function () {
let ownerCookie;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
ownerCookie = await localUtils.doAuth(request, 'users:extra', 'posts');
});

View File

@ -13,7 +13,7 @@ let request;
describe('Redirects API', function () {
const startGhost = async (options) => {
await testUtils.startGhost(options);
await localUtils.startGhost(options);
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
};

View File

@ -26,7 +26,7 @@ describe('v2 Schedules API', function () {
});
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));

View File

@ -95,7 +95,7 @@ describe('Settings API (v2)', function () {
describe('As Owner', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
});
@ -722,7 +722,7 @@ describe('Settings API (v2)', function () {
describe('As Admin', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create admin
@ -738,7 +738,7 @@ describe('Settings API (v2)', function () {
describe('As Editor', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create editor
request.user = await testUtils.createUser({
@ -790,7 +790,7 @@ describe('Settings API (v2)', function () {
describe('As Author', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create author

View File

@ -8,7 +8,7 @@ describe('Config API (v2)', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
});

View File

@ -10,7 +10,7 @@ let request;
describe('Slack API', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
});

View File

@ -11,7 +11,7 @@ describe('User API', function () {
let otherAuthor;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create inactive user
@ -130,7 +130,7 @@ describe('User API', function () {
let editor;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create editor
editor = await testUtils.createUser({
@ -204,7 +204,7 @@ describe('User API', function () {
let author;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create author
author = await testUtils.createUser({

View File

@ -126,6 +126,15 @@ module.exports = {
return testUtils.API.doAuth(`${API_URL}session/`, ...args);
},
async startGhost(overrides = {}) {
const defaults = {
backend: true,
frontend: false
};
return await testUtils.startGhost(Object.assign(defaults, overrides));
},
getValidAdminToken(endpoint, key) {
const jwt = require('jsonwebtoken');
key = key || testUtils.DataGenerator.Content.api_keys[0];

View File

@ -9,7 +9,7 @@ describe('Webhooks API (v2)', function () {
const API_VERSION = 'v2';
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));

View File

@ -10,7 +10,7 @@ describe('Authors Content API', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await testUtils.initFixtures('owner:post', 'users:no-owner', 'user:inactive', 'posts', 'api_keys');
});

View File

@ -10,7 +10,7 @@ let request;
describe('api/v2/content/pages', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await testUtils.initFixtures('users:no-owner', 'user:inactive', 'posts', 'tags:extra', 'api_keys');
});

View File

@ -16,7 +16,7 @@ describe('api/v2/content/posts', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await testUtils.initFixtures('users:no-owner', 'user:inactive', 'posts', 'tags:extra', 'api_keys');
});

View File

@ -10,7 +10,7 @@ let request;
describe('api/v2/content/tags', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await testUtils.initFixtures('users:no-owner', 'user:inactive', 'posts', 'tags:extra', 'api_keys');
});

View File

@ -110,5 +110,14 @@ module.exports = {
},
getValidKey() {
return testUtils.DataGenerator.Content.api_keys[1].secret;
},
async startGhost(overrides = {}) {
const defaults = {
backend: true,
frontend: false
};
return await testUtils.startGhost(Object.assign(defaults, overrides));
}
};

View File

@ -14,7 +14,7 @@ let request;
describe('Authentication API v3', function () {
describe('Blog setup', function () {
before(async function () {
await testUtils.startGhost({forceStart: true});
await localUtils.startGhost({forceStart: true});
request = supertest.agent(config.get('url'));
});
@ -132,7 +132,7 @@ describe('Authentication API v3', function () {
describe('Invitation', function () {
before(function () {
return testUtils.startGhost()
return localUtils.startGhost()
.then(function () {
request = supertest.agent(config.get('url'));
@ -227,7 +227,7 @@ describe('Authentication API v3', function () {
const user = testUtils.DataGenerator.forModel.users[0];
before(function () {
return testUtils.startGhost({forceStart: true})
return localUtils.startGhost({forceStart: true})
.then(() => {
request = supertest.agent(config.get('url'));
})

View File

@ -19,7 +19,7 @@ describe('DB API (v3)', function () {
let schedulerKey;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
backupKey = _.find(testUtils.getExistingData().apiKeys, {integration: {slug: 'ghost-backup'}});

View File

@ -33,7 +33,7 @@ const verifyJWKS = (endpoint, token) => {
describe('Identities API', function () {
describe('As Owner', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
});
@ -66,7 +66,7 @@ describe('Identities API', function () {
describe('As non-Owner', function () {
before(function () {
return testUtils.startGhost()
return localUtils.startGhost()
.then(function () {
request = supertest.agent(config.get('url'));
})

View File

@ -11,7 +11,7 @@ describe('Images API', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
});

View File

@ -14,7 +14,7 @@ describe('Labels API', function () {
});
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
});

View File

@ -21,7 +21,7 @@ describe('Members API', function () {
});
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request, 'members');
});

View File

@ -20,7 +20,7 @@ describe('Members Sigin URL API', function () {
describe('As Owner', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request, 'member');
});
@ -45,7 +45,7 @@ describe('Members Sigin URL API', function () {
describe('As Admin', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
const admin = await testUtils.createUser({
user: testUtils.DataGenerator.forKnex.createUser({email: 'admin+1@ghost.org'}),
@ -76,7 +76,7 @@ describe('Members Sigin URL API', function () {
describe('As non-Owner and non-Admin', function () {
before(function () {
return testUtils.startGhost()
return localUtils.startGhost()
.then(function () {
request = supertest.agent(config.get('url'));
})

View File

@ -9,7 +9,7 @@ describe('Notifications API', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
const user = await testUtils.createUser({
user: testUtils.DataGenerator.forKnex.createUser({
@ -64,7 +64,7 @@ describe('Notifications API', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
const user = await testUtils.createUser({
@ -107,7 +107,7 @@ describe('Notifications API', function () {
let notification;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
requestEditor1 = supertest.agent(config.get('url'));
requestEditor2 = supertest.agent(config.get('url'));

View File

@ -7,7 +7,7 @@ let request;
describe('Pages API', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request, 'posts');
});

View File

@ -13,7 +13,7 @@ describe('Posts API (v3)', function () {
let ownerCookie;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
ownerCookie = await localUtils.doAuth(request, 'users:extra', 'posts', 'emails');

View File

@ -13,7 +13,7 @@ let request;
describe('Redirects API', function () {
const startGhost = async (options) => {
await testUtils.startGhost(options);
await localUtils.startGhost(options);
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
};

View File

@ -26,7 +26,7 @@ describe('v3 Schedules API', function () {
});
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));

View File

@ -99,7 +99,7 @@ describe('Settings API (v3)', function () {
describe('As Owner', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
});
@ -716,7 +716,7 @@ describe('Settings API (v3)', function () {
describe('As Admin', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create admin
@ -732,7 +732,7 @@ describe('Settings API (v3)', function () {
describe('As Editor', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create editor
request.user = await testUtils.createUser({
@ -784,7 +784,7 @@ describe('Settings API (v3)', function () {
describe('As Author', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create author

View File

@ -8,7 +8,7 @@ describe('Config API (v3)', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
});

View File

@ -10,7 +10,7 @@ let request;
describe('Slack API', function () {
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await localUtils.doAuth(request);
});

View File

@ -11,7 +11,7 @@ describe('User API', function () {
let otherAuthor;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create inactive user
@ -130,7 +130,7 @@ describe('User API', function () {
let editor;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create editor
editor = await testUtils.createUser({
@ -204,7 +204,7 @@ describe('User API', function () {
let author;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
// create author
author = await testUtils.createUser({

View File

@ -137,6 +137,15 @@ module.exports = {
return testUtils.API.doAuth(`${API_URL}session/`, ...args);
},
async startGhost(overrides = {}) {
const defaults = {
backend: true,
frontend: false
};
return await testUtils.startGhost(Object.assign(defaults, overrides));
},
getValidAdminToken(endpoint, key) {
const jwt = require('jsonwebtoken');
key = key || testUtils.DataGenerator.Content.api_keys[0];

View File

@ -9,7 +9,7 @@ describe('Webhooks API (v3)', function () {
const API_VERSION = 'v3';
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));

View File

@ -10,7 +10,7 @@ describe('Authors Content API', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await testUtils.initFixtures('owner:post', 'users:no-owner', 'user:inactive', 'posts', 'api_keys');
});

View File

@ -11,7 +11,7 @@ describe('api/v3/content/pages', function () {
const key = localUtils.getValidKey();
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await testUtils.initFixtures('users:no-owner', 'user:inactive', 'posts', 'tags:extra', 'api_keys');
});

View File

@ -12,7 +12,7 @@ describe('api/v3/content/posts', function () {
let request;
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await testUtils.initFixtures('users:no-owner', 'user:inactive', 'posts', 'tags:extra', 'api_keys');
});

View File

@ -12,7 +12,7 @@ describe('api/v3/content/tags', function () {
const validKey = localUtils.getValidKey();
before(async function () {
await testUtils.startGhost();
await localUtils.startGhost();
request = supertest.agent(config.get('url'));
await testUtils.initFixtures('users:no-owner', 'user:inactive', 'posts', 'tags:extra', 'api_keys');
});

View File

@ -99,5 +99,14 @@ module.exports = {
},
getValidKey() {
return testUtils.DataGenerator.Content.api_keys[1].secret;
},
async startGhost(overrides = {}) {
const defaults = {
backend: true,
frontend: false
};
return await testUtils.startGhost(Object.assign(defaults, overrides));
}
};