mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 13:52:10 +03:00
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:
parent
222273b66b
commit
ac3b2e5aee
@ -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'));
|
||||
})
|
||||
|
@ -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'}});
|
||||
|
@ -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'));
|
||||
})
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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'));
|
||||
})
|
||||
|
@ -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'));
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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);
|
||||
};
|
||||
|
@ -26,7 +26,7 @@ describe('Canary Schedules API', function () {
|
||||
});
|
||||
|
||||
before(async function () {
|
||||
await testUtils.startGhost();
|
||||
await localUtils.startGhost();
|
||||
|
||||
request = supertest.agent(config.get('url'));
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -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({
|
||||
|
@ -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];
|
||||
|
@ -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'));
|
||||
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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));
|
||||
}
|
||||
};
|
||||
|
@ -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'));
|
||||
})
|
||||
|
@ -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'}});
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -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'));
|
||||
|
@ -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'));
|
||||
})
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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);
|
||||
};
|
||||
|
@ -26,7 +26,7 @@ describe('v2 Schedules API', function () {
|
||||
});
|
||||
|
||||
before(async function () {
|
||||
await testUtils.startGhost();
|
||||
await localUtils.startGhost();
|
||||
|
||||
request = supertest.agent(config.get('url'));
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -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({
|
||||
|
@ -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];
|
||||
|
@ -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'));
|
||||
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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));
|
||||
}
|
||||
};
|
||||
|
@ -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'));
|
||||
})
|
||||
|
@ -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'}});
|
||||
|
@ -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'));
|
||||
})
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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'));
|
||||
})
|
||||
|
@ -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'));
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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');
|
||||
|
@ -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);
|
||||
};
|
||||
|
@ -26,7 +26,7 @@ describe('v3 Schedules API', function () {
|
||||
});
|
||||
|
||||
before(async function () {
|
||||
await testUtils.startGhost();
|
||||
await localUtils.startGhost();
|
||||
|
||||
request = supertest.agent(config.get('url'));
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -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({
|
||||
|
@ -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];
|
||||
|
@ -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'));
|
||||
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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');
|
||||
});
|
||||
|
@ -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));
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user