From bc3cb20a439ddd640064adfd5e697fd2a2a9bc29 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Sat, 3 Oct 2020 12:16:54 -0400 Subject: [PATCH] chore: full coverage for orgs route --- ui/core/app/routes/scopes/scope/orgs.js | 8 +++----- ui/core/tests/acceptance/authentication-test.js | 7 +++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ui/core/app/routes/scopes/scope/orgs.js b/ui/core/app/routes/scopes/scope/orgs.js index 76ff7b208..626de80fa 100644 --- a/ui/core/app/routes/scopes/scope/orgs.js +++ b/ui/core/app/routes/scopes/scope/orgs.js @@ -38,9 +38,8 @@ export default class ScopesScopeOrgsRoute extends Route { */ @action cancel(org) { - const { isNew } = org; org.rollbackAttributes(); - if (isNew) this.transitionTo('scopes.scope.orgs'); + this.transitionTo('scopes.scope.orgs'); } /** @@ -51,13 +50,12 @@ export default class ScopesScopeOrgsRoute extends Route { @action @loading async save(org) { - const { isNew } = org; try { await org.save(); - await this.transitionTo('scopes.scope', org); + await this.transitionTo('scopes.scope.projects', org); this.refresh(); this.notify.success( - this.intl.t(isNew ? 'notifications.create-success' : 'notifications.save-success') + this.intl.t('notifications.create-success') ); } catch (error) { // TODO: replace with translated strings diff --git a/ui/core/tests/acceptance/authentication-test.js b/ui/core/tests/acceptance/authentication-test.js index 9a6641194..1816d1ae0 100644 --- a/ui/core/tests/acceptance/authentication-test.js +++ b/ui/core/tests/acceptance/authentication-test.js @@ -105,6 +105,13 @@ module('Acceptance | authentication', function (hooks) { assert.notOk(currentSession().isAuthenticated); }); + test('visiting orgs while unauthenticated redirects to first global authenticate method', async function (assert) { + assert.expect(2); + await visit(orgsURL); + assert.equal(currentURL(), authMethodGlobalAuthenticateURL); + assert.notOk(currentSession().isAuthenticated); + }); + test('visiting projects while unauthenticated redirects to first global authenticate method', async function (assert) { assert.expect(2); await visit(projectsURL);