From 685b291a5207e93a416aadb0f34c6613c829a6c2 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Sat, 3 Oct 2020 12:30:08 -0400 Subject: [PATCH] chore: add missing unauthenticated redirect tests --- .../tests/acceptance/authentication-test.js | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/ui/core/tests/acceptance/authentication-test.js b/ui/core/tests/acceptance/authentication-test.js index 1816d1ae0..b5a4ba249 100644 --- a/ui/core/tests/acceptance/authentication-test.js +++ b/ui/core/tests/acceptance/authentication-test.js @@ -39,6 +39,10 @@ module('Acceptance | authentication', function (hooks) { let authMethodGlobalAuthenticateURL; let orgsURL; let projectsURL; + let usersURL; + let groupsURL; + let rolesURL; + let authMethodsURL; hooks.beforeEach(function () { invalidateSession(); @@ -68,6 +72,10 @@ module('Acceptance | authentication', function (hooks) { authMethodAuthenticateURL = `/scopes/${orgScopeID}/authenticate/${authMethodID}`; orgsURL = `/scopes/global/orgs`; projectsURL = `/scopes/${orgScopeID}/projects`; + usersURL = `/scopes/${orgScopeID}/users`; + groupsURL = `/scopes/${orgScopeID}/groups`; + rolesURL = `/scopes/${orgScopeID}/roles`; + authMethodsURL = `/scopes/${orgScopeID}/auth-methods`; }); test('visiting auth methods authenticate route redirects to first auth method', async function (assert) { @@ -119,6 +127,34 @@ module('Acceptance | authentication', function (hooks) { assert.notOk(currentSession().isAuthenticated); }); + test('visiting users while unauthenticated redirects to first global authenticate method', async function (assert) { + assert.expect(2); + await visit(usersURL); + assert.equal(currentURL(), authMethodGlobalAuthenticateURL); + assert.notOk(currentSession().isAuthenticated); + }); + + test('visiting roles while unauthenticated redirects to first global authenticate method', async function (assert) { + assert.expect(2); + await visit(rolesURL); + assert.equal(currentURL(), authMethodGlobalAuthenticateURL); + assert.notOk(currentSession().isAuthenticated); + }); + + test('visiting groups while unauthenticated redirects to first global authenticate method', async function (assert) { + assert.expect(2); + await visit(groupsURL); + assert.equal(currentURL(), authMethodGlobalAuthenticateURL); + assert.notOk(currentSession().isAuthenticated); + }); + + test('visiting auth methods while unauthenticated redirects to first global authenticate method', async function (assert) { + assert.expect(2); + await visit(authMethodsURL); + assert.equal(currentURL(), authMethodGlobalAuthenticateURL); + assert.notOk(currentSession().isAuthenticated); + }); + test('visiting auth method authenticate route', async function (assert) { assert.expect(1); await visit(authMethodAuthenticateURL);