chore: add missing unauthenticated redirect tests

This commit is contained in:
Randall Morey committed 2020-10-03 12:30:08 -04:00
1 parent bc3cb20a43
commit 685b291a52
1 file changed
+36
@@ -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);