fix: 🐛 OIDC authentications not properly showing username (#2930)
* fix: 🐛 properly show username for oidc auth method in user menu * test: 💍 fix admin ui tests * test: 💍 fix desktop ui tests * refactor: 💡 admin to not store username in authenticated object * refactor: 💡 use getter in app controller * test: 💍 POC for how we could update our tests to use auth account * refactor: 💡 remove unused service * test: 💍 fix all tests in ui/admin * test: 💍 revert one change * refactor: 💡 update ui/desktop w/ feedback + fix tests * refactor: 💡 add in error handling * refactor: 💡 cleanup unused service * test: 💍 fix e2e test selector ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-17231
This commit is contained in:
1 parent
838bc37243
commit
72f7c8a92d
195 files changed
+720
-1112
No files matched your search
@@ -6,10 +6,8 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import {
|
||||
TYPE_AUTH_METHOD_PASSWORD,
|
||||
TYPE_AUTH_METHOD_LDAP,
|
||||
@@ -21,7 +19,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
|
||||
module('Acceptance | users | accounts', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let accountsCount;
|
||||
@@ -29,7 +26,6 @@ module('Acceptance | users | accounts', function (hooks) {
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
global: null,
|
||||
org: null,
|
||||
},
|
||||
user: null,
|
||||
@@ -43,8 +39,6 @@ module('Acceptance | users | accounts', function (hooks) {
|
||||
};
|
||||
|
||||
hooks.beforeEach(async function () {
|
||||
await authenticateSession({ username: 'admin' });
|
||||
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
||||
instances.scopes.org = this.server.create('scope', {
|
||||
type: 'org',
|
||||
scope: { id: 'global', type: 'global' },
|
||||
@@ -298,8 +292,8 @@ module('Acceptance | users | accounts', function (hooks) {
|
||||
authMethod,
|
||||
});
|
||||
const accountsAvailableCount =
|
||||
this.server.schema.accounts.all().length -
|
||||
instances.user.accountIds.length;
|
||||
this.server.schema.accounts.where({ scopeId: instances.scopes.org.id })
|
||||
.length - instances.user.accountIds.length;
|
||||
await visit(urls.user);
|
||||
|
||||
await click(commonSelectors.HREF(urls.accounts));
|
||||
@@ -332,8 +326,8 @@ module('Acceptance | users | accounts', function (hooks) {
|
||||
authMethod,
|
||||
});
|
||||
const accountsAvailableCount =
|
||||
this.server.schema.accounts.all().length -
|
||||
instances.user.accountIds.length;
|
||||
this.server.schema.accounts.where({ scopeId: instances.scopes.org.id })
|
||||
.length - instances.user.accountIds.length;
|
||||
await visit(urls.user);
|
||||
|
||||
await click(commonSelectors.HREF(urls.accounts));
|
||||
@@ -470,9 +464,7 @@ module('Acceptance | users | accounts', function (hooks) {
|
||||
},
|
||||
});
|
||||
|
||||
this.server.schema.authMethods.all().destroy();
|
||||
this.server.schema.users.all().destroy();
|
||||
this.server.schema.accounts.all().destroy();
|
||||
|
||||
const authMethod = this.server.create(
|
||||
'auth-method',
|
||||
@@ -508,9 +500,7 @@ module('Acceptance | users | accounts', function (hooks) {
|
||||
},
|
||||
});
|
||||
|
||||
this.server.schema.authMethods.all().destroy();
|
||||
this.server.schema.users.all().destroy();
|
||||
this.server.schema.accounts.all().destroy();
|
||||
|
||||
const authMethod = this.server.create(
|
||||
'auth-method',
|
||||
|
||||
@@ -6,23 +6,19 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
|
||||
module('Acceptance | users | create', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let getUsersCount;
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
global: null,
|
||||
org: null,
|
||||
},
|
||||
user: null,
|
||||
@@ -36,7 +32,6 @@ module('Acceptance | users | create', function (hooks) {
|
||||
};
|
||||
|
||||
hooks.beforeEach(async function () {
|
||||
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
||||
instances.scopes.org = this.server.create('scope', {
|
||||
type: 'org',
|
||||
scope: { id: 'global', type: 'global' },
|
||||
@@ -51,7 +46,6 @@ module('Acceptance | users | create', function (hooks) {
|
||||
getUsersCount = () => {
|
||||
return this.server.schema.users.all().models.length;
|
||||
};
|
||||
await authenticateSession({});
|
||||
});
|
||||
|
||||
test('can create new users', async function (assert) {
|
||||
|
||||
@@ -6,17 +6,14 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { visit, click, currentURL } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import * as selectors from './selectors';
|
||||
import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
|
||||
module('Acceptance | users | delete', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let getUsersCount, confirmService;
|
||||
@@ -36,7 +33,6 @@ module('Acceptance | users | delete', function (hooks) {
|
||||
};
|
||||
|
||||
hooks.beforeEach(async function () {
|
||||
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
||||
instances.scopes.org = this.server.create('scope', {
|
||||
type: 'org',
|
||||
scope: { id: 'global', type: 'global' },
|
||||
@@ -49,8 +45,6 @@ module('Acceptance | users | delete', function (hooks) {
|
||||
urls.user = `${urls.users}/${instances.user.id}`;
|
||||
getUsersCount = () => this.server.schema.users.all().models.length;
|
||||
confirmService = this.owner.lookup('service:confirm');
|
||||
|
||||
await authenticateSession({});
|
||||
});
|
||||
|
||||
test('can delete a user', async function (assert) {
|
||||
|
||||
@@ -13,9 +13,7 @@ import {
|
||||
currentURL,
|
||||
} from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import * as selectors from './selectors';
|
||||
import { faker } from '@faker-js/faker';
|
||||
@@ -23,12 +21,10 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
|
||||
module('Acceptance | users | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
global: null,
|
||||
org: null,
|
||||
},
|
||||
user1: null,
|
||||
@@ -44,7 +40,6 @@ module('Acceptance | users | list', function (hooks) {
|
||||
};
|
||||
|
||||
hooks.beforeEach(async function () {
|
||||
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
||||
instances.scopes.org = this.server.create('scope', {
|
||||
type: 'org',
|
||||
scope: { id: 'global', type: 'global' },
|
||||
@@ -60,7 +55,6 @@ module('Acceptance | users | list', function (hooks) {
|
||||
urls.users = `${urls.orgScope}/users`;
|
||||
urls.user1 = `${urls.users}/${instances.user1.id}`;
|
||||
urls.user2 = `${urls.users}/${instances.user2.id}`;
|
||||
await authenticateSession({});
|
||||
});
|
||||
|
||||
test('users can navigate to users with proper authorization', async function (assert) {
|
||||
|
||||
@@ -6,15 +6,12 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
|
||||
module('Acceptance | users | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
const urls = {
|
||||
@@ -25,14 +22,12 @@ module('Acceptance | users | read', function (hooks) {
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
global: null,
|
||||
org: null,
|
||||
},
|
||||
user: null,
|
||||
};
|
||||
|
||||
hooks.beforeEach(async function () {
|
||||
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
||||
instances.scopes.org = this.server.create('scope', {
|
||||
type: 'org',
|
||||
scope: { id: 'global', type: 'global' },
|
||||
@@ -43,7 +38,6 @@ module('Acceptance | users | read', function (hooks) {
|
||||
urls.orgScope = `/scopes/${instances.scopes.org.id}`;
|
||||
urls.users = `${urls.orgScope}/users`;
|
||||
urls.user = `${urls.users}/${instances.user.id}`;
|
||||
await authenticateSession({ username: 'admin' });
|
||||
});
|
||||
|
||||
test('visiting users', async function (assert) {
|
||||
|
||||
@@ -6,16 +6,13 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
|
||||
module('Acceptance | users | update', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let confirmService;
|
||||
@@ -28,14 +25,12 @@ module('Acceptance | users | update', function (hooks) {
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
global: null,
|
||||
org: null,
|
||||
},
|
||||
user: null,
|
||||
};
|
||||
|
||||
hooks.beforeEach(async function () {
|
||||
instances.scopes.global = this.server.create('scope', { id: 'global' });
|
||||
instances.scopes.org = this.server.create('scope', {
|
||||
type: 'org',
|
||||
scope: { id: 'global', type: 'global' },
|
||||
@@ -47,8 +42,6 @@ module('Acceptance | users | update', function (hooks) {
|
||||
urls.users = `${urls.orgScope}/users`;
|
||||
urls.user = `${urls.users}/${instances.user.id}`;
|
||||
confirmService = this.owner.lookup('service:confirm');
|
||||
|
||||
await authenticateSession({});
|
||||
});
|
||||
|
||||
test('can save changes to an existing user', async function (assert) {
|
||||
|
||||
Reference in new issue
Block a user