Ghost/ghost/admin/tests/helpers/mailgun.js
Kevin Ansfield 3f0e46c7b0 Added initial tests for new publish flow
refs https://github.com/TryGhost/Team/issues/1586

- added test helper for enabling/disabling members and helpers for disabling mailgun and newsletters
- added `loginAsRole` helper that alleviates duplication of user+role creation and also handles log-out before log-in so it's easier to mix different role tests within a block that has a default role setup in `beforeEach()`
- cleaned up editor tests that were skipped due to using the old publish flow
- added `Publish flow` acceptance test suite with an initial batch of tests
2022-05-30 19:12:16 +01:00

18 lines
996 B
JavaScript

export function enableMailgun(server, enabled = true) {
server.db.settings.find({key: 'mailgun_api_key'})
? server.db.settings.update({key: 'mailgun_api_key'}, {value: (enabled ? 'MAILGUN_API_KEY' : null)})
: server.create('setting', {key: 'mailgun_api_key', value: (enabled ? 'MAILGUN_API_KEY' : null), group: 'email'});
server.db.settings.find({key: 'mailgun_domain'})
? server.db.settings.update({key: 'mailgun_domain'}, {value: (enabled ? 'MAILGUN_DOMAIN' : null)})
: server.create('setting', {key: 'mailgun_domain', value: (enabled ? 'MAILGUN_DOMAIN' : null), group: 'email'});
server.db.settings.find({key: 'mailgun_base_url'})
? server.db.settings.update({key: 'mailgun_base_url'}, {value: (enabled ? 'MAILGUN_BASE_URL' : null)})
: server.create('setting', {key: 'mailgun_base_url', value: (enabled ? 'MAILGUN_BASE_URL' : null), group: 'email'});
}
export function disableMailgun(server) {
enableMailgun(server, false);
}