chore: add unauthenticated redirect test

This commit is contained in:
Randall Morey committed 2020-10-03 12:57:21 -04:00
1 parent f7f2770dca
commit 87e1fd363e
1 file changed
+9
@@ -37,6 +37,7 @@ module('Acceptance | authentication', function (hooks) {
let authenticateURL;
let authMethodAuthenticateURL;
let authMethodGlobalAuthenticateURL;
let changePasswordURL;
let orgsURL;
let projectsURL;
let usersURL;
@@ -70,6 +71,7 @@ module('Acceptance | authentication', function (hooks) {
authenticateURL = `/scopes/${orgScopeID}/authenticate`;
authMethodGlobalAuthenticateURL = `/scopes/global/authenticate/${globalAuthMethodID}`;
authMethodAuthenticateURL = `/scopes/${orgScopeID}/authenticate/${authMethodID}`;
changePasswordURL = `/account/change-password`;
orgsURL = `/scopes/global/orgs`;
projectsURL = `/scopes/${orgScopeID}/projects`;
usersURL = `/scopes/${orgScopeID}/users`;
@@ -113,6 +115,13 @@ module('Acceptance | authentication', function (hooks) {
assert.notOk(currentSession().isAuthenticated);
});
test('visiting change password while unauthenticated redirects to first global authenticate method', async function (assert) {
assert.expect(2);
await visit(changePasswordURL);
assert.equal(currentURL(), authMethodGlobalAuthenticateURL);
assert.notOk(currentSession().isAuthenticated);
});
test('visiting orgs while unauthenticated redirects to first global authenticate method', async function (assert) {
assert.expect(2);
await visit(orgsURL);