diff --git a/core/server/services/auth/setup.js b/core/server/services/auth/setup.js index 8d37f0a9d2..f54fa971fc 100644 --- a/core/server/services/auth/setup.js +++ b/core/server/services/auth/setup.js @@ -12,7 +12,8 @@ const messages = { setupUnableToRun: 'Database missing fixture data. Please reset database and try again.', sampleBlogDescription: 'Thoughts, stories and ideas.', yourNewGhostBlog: 'Your New Ghost Site', - unableToSendWelcomeEmail: 'Unable to send welcome email, your site will continue to function.' + unableToSendWelcomeEmail: 'Unable to send welcome email, your site will continue to function.', + failedThemeInstall: 'Theme {themeName} didn\'t install because of the error: {error}' }; /** @@ -169,8 +170,9 @@ async function installTheme(data, api) { name: theme.name, context: {internal: true} }); - } catch (e) { + } catch (error) { //Fallback to Casper by doing nothing as the theme setting update is the last step + logging.warn(tpl(messages.failedThemeInstall, {themeName, error: error.message})); await api.notifications.add({ notifications: [{ diff --git a/test/regression/api/admin/authentication.test.js b/test/regression/api/admin/authentication.test.js index d7acd51658..83d2bef988 100644 --- a/test/regression/api/admin/authentication.test.js +++ b/test/regression/api/admin/authentication.test.js @@ -1,3 +1,4 @@ +const nock = require('nock'); const assert = require('assert'); const {agentProvider, mockManager, fixtureManager, matchers} = require('../../../utils/e2e-framework'); const {anyEtag, anyDate, anyErrorId} = matchers; @@ -20,6 +21,7 @@ describe('Authentication API', function () { afterEach(function () { mockManager.restore(); + nock.cleanAll(); }); it('is setup? no', async function () { @@ -33,6 +35,11 @@ describe('Authentication API', function () { }); it('complete setup', async function () { + const requestMock = nock('https://api.github.com') + .get('/repos/tryghost/dawn/zipball') + .query(true) + .replyWithFile(200, __dirname + '/../../../utils/fixtures/themes/valid.zip'); + await agent .post('authentication/setup') .body({ @@ -60,9 +67,10 @@ describe('Authentication API', function () { subject: 'Your New Ghost Site', to: 'test@example.com' }); + assert.equal(requestMock.isDone(), true, 'The dawn github URL should have been used'); const activeTheme = await settingsCache.get('active_theme'); - assert.equal(activeTheme, 'dawn', 'The theme dawn should have been isntalled'); + assert.equal(activeTheme, 'dawn', 'The theme dawn should have been installed'); }); it('is setup? yes', async function () {