mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Refactored authentication test suite to serverless boot
refs https://github.com/TryGhost/Toolbox/issues/152 - This is a continuation of an experiment to switch over to serverless boot in regression tests. Just a proofe of concept that authentication scenarios would also work and the expectations don't collapse unexpectedly. - Nothing too crazy so far, easy and straight forward substitution of the config "url" with an express app passed to the supertest agent
This commit is contained in:
parent
4a1bee0a01
commit
b7231875a0
1 changed files with 17 additions and 26 deletions
|
@ -11,11 +11,11 @@ const mailService = require('../../../../../core/server/services/mail/index');
|
||||||
|
|
||||||
let request;
|
let request;
|
||||||
|
|
||||||
describe('Authentication API v3', function () {
|
describe('Authentication API canary', function () {
|
||||||
describe('Blog setup', function () {
|
describe('Blog setup', function () {
|
||||||
before(async function () {
|
before(async function () {
|
||||||
await localUtils.startGhost({forceStart: true});
|
const app = await localUtils.startGhost({forceStart: true});
|
||||||
request = supertest.agent(config.get('url'));
|
request = supertest.agent(app);
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
|
@ -132,14 +132,11 @@ describe('Authentication API v3', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Invitation', function () {
|
describe('Invitation', function () {
|
||||||
before(function () {
|
before(async function () {
|
||||||
return localUtils.startGhost()
|
const app = await localUtils.startGhost();
|
||||||
.then(function () {
|
request = supertest.agent(app);
|
||||||
request = supertest.agent(config.get('url'));
|
|
||||||
|
|
||||||
// simulates blog setup (initialises the owner)
|
await localUtils.doAuth(request, 'invites');
|
||||||
return localUtils.doAuth(request, 'invites');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('check invite with invalid email', function () {
|
it('check invite with invalid email', function () {
|
||||||
|
@ -227,14 +224,11 @@ describe('Authentication API v3', function () {
|
||||||
describe('Password reset', function () {
|
describe('Password reset', function () {
|
||||||
const user = testUtils.DataGenerator.forModel.users[0];
|
const user = testUtils.DataGenerator.forModel.users[0];
|
||||||
|
|
||||||
before(function () {
|
before(async function () {
|
||||||
return localUtils.startGhost({forceStart: true})
|
const app = await localUtils.startGhost({forceStart: true});
|
||||||
.then(() => {
|
request = supertest.agent(app);
|
||||||
request = supertest.agent(config.get('url'));
|
|
||||||
})
|
await localUtils.doAuth(request);
|
||||||
.then(() => {
|
|
||||||
return localUtils.doAuth(request);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
|
@ -393,14 +387,11 @@ describe('Authentication API v3', function () {
|
||||||
|
|
||||||
describe('Reset all passwords', function () {
|
describe('Reset all passwords', function () {
|
||||||
let sendEmail;
|
let sendEmail;
|
||||||
before(function () {
|
before(async function () {
|
||||||
return localUtils.startGhost({forceStart: true})
|
const app = await localUtils.startGhost({forceStart: true});
|
||||||
.then(() => {
|
request = supertest.agent(app);
|
||||||
request = supertest.agent(config.get('url'));
|
|
||||||
})
|
await localUtils.doAuth(request);
|
||||||
.then(() => {
|
|
||||||
return localUtils.doAuth(request);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
|
|
Loading…
Reference in a new issue