mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Updated all members tests to use mockManager
- This part of the framework can be used in isolation - Using mockManager everywhere makes it more visible how to use it - Aside: fixed .getAdminAPIAgent not needing a URL in site tests whilst cleaning up
This commit is contained in:
parent
83aa35241a
commit
c80e68b93a
3 changed files with 12 additions and 21 deletions
|
@ -2,24 +2,15 @@ const path = require('path');
|
|||
const querystring = require('querystring');
|
||||
const should = require('should');
|
||||
const supertest = require('supertest');
|
||||
const sinon = require('sinon');
|
||||
const testUtils = require('../../../utils');
|
||||
const localUtils = require('./utils');
|
||||
const config = require('../../../../core/shared/config');
|
||||
const labs = require('../../../../core/shared/labs');
|
||||
const mailService = require('../../../../core/server/services/mail');
|
||||
|
||||
const {mockManager} = require('../../../utils/e2e-framework');
|
||||
|
||||
let request;
|
||||
|
||||
describe('Members Importer API', function () {
|
||||
before(function () {
|
||||
sinon.stub(labs, 'isSet').withArgs('members').returns(true);
|
||||
});
|
||||
|
||||
after(function () {
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
before(async function () {
|
||||
await localUtils.startGhost();
|
||||
request = supertest.agent(config.get('url'));
|
||||
|
@ -27,11 +18,12 @@ describe('Members Importer API', function () {
|
|||
});
|
||||
|
||||
beforeEach(function () {
|
||||
sinon.stub(mailService.GhostMailer.prototype, 'send').resolves('Mail is disabled');
|
||||
mockManager.mockMail();
|
||||
mockManager.mockLabsEnabled('members');
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
sinon.restore();
|
||||
mockManager.restore();
|
||||
});
|
||||
|
||||
it('Can import CSV with minimum one field and labels', function () {
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
const path = require('path');
|
||||
const should = require('should');
|
||||
const supertest = require('supertest');
|
||||
const sinon = require('sinon');
|
||||
const testUtils = require('../../../utils');
|
||||
const localUtils = require('./utils');
|
||||
const config = require('../../../../core/shared/config');
|
||||
const labs = require('../../../../core/shared/labs');
|
||||
|
||||
const {mockManager} = require('../../../utils/e2e-framework');
|
||||
|
||||
let request;
|
||||
|
||||
describe('Members Sigin URL API', function () {
|
||||
before(function () {
|
||||
sinon.stub(labs, 'isSet').withArgs('members').returns(true);
|
||||
beforeEach(function () {
|
||||
mockManager.mockLabsEnabled('members');
|
||||
});
|
||||
|
||||
after(function () {
|
||||
sinon.restore();
|
||||
afterEach(function () {
|
||||
mockManager.restore();
|
||||
});
|
||||
|
||||
describe('As Owner', function () {
|
||||
|
|
|
@ -5,7 +5,7 @@ describe('Site API', function () {
|
|||
let agent;
|
||||
|
||||
before(async function () {
|
||||
agent = await agentProvider.getAdminAPIAgent('/ghost/api/canary/admin/');
|
||||
agent = await agentProvider.getAdminAPIAgent();
|
||||
});
|
||||
|
||||
it('can retrieve config and all expected properties', async function () {
|
||||
|
|
Loading…
Reference in a new issue