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:
Lisbet Alvarez authored and GitHub committed 2025-10-30 12:49:30 -07:00
1 parent 838bc37243
commit 72f7c8a92d
195 files changed
+720 -1112

No files matched your search

@@ -9,7 +9,6 @@ import { visit } from '@ember/test-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 { TYPE_AUTH_METHOD_PASSWORD } from 'api/models/auth-method';
module('Unit | Controller | account/change-password', function (hooks) {
setupTest(hooks);
@@ -34,23 +33,21 @@ module('Unit | Controller | account/change-password', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
instances.authMethod = this.server.schema.authMethods.first();
instances.account = this.server.schema.accounts.first();
await authenticateSession({
isGlobal: true,
account_id: instances.account.id,
});
controller = this.owner.lookup('controller:account/change-password');
store = this.owner.lookup('service:store');
instances.scopes.global = this.server.create('scope', {
id: 'global',
type: 'global',
});
instances.authMethod = this.server.create('auth-method', {
scope: instances.scopes.global,
type: TYPE_AUTH_METHOD_PASSWORD,
});
instances.account = this.server.create('account', {
scope: instances.scopes.global,
authMethod: instances.authMethod,
});
urls.globalScope = `/scopes/global`;
});
@@ -36,13 +36,19 @@ module('Unit | Controller | onboarding/index', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:onboarding/index');
instances.scopes.global = this.server.create('scope', {
id: 'global',
type: 'global',
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
instances.authMethod = this.server.schema.authMethods.first();
instances.account = this.server.schema.accounts.first();
await authenticateSession({
isGlobal: true,
account_id: instances.account.id,
});
urls.onboarding = '/onboarding';
@@ -33,13 +33,19 @@ module('Unit | Controller | onboarding/success', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
controller = this.owner.lookup('controller:onboarding/success');
store = this.owner.lookup('service:store');
instances.scopes.global = this.server.create('scope', {
id: 'global',
type: 'global',
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
instances.authMethod = this.server.schema.authMethods.first();
instances.account = this.server.schema.accounts.first();
await authenticateSession({
isGlobal: true,
account_id: instances.account.id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -31,15 +31,22 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/add-storage-policy/create',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.policy = this.server.create('policy', {
scopeId: 'global',
scope: instances.scopes.global,
});
urls.globalScope = `/scopes/global`;
@@ -31,15 +31,22 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/add-storage-policy/index',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.policy = this.server.create('policy', {
scopeId: 'global',
scope: instances.scopes.global,
});
urls.globalScope = `/scopes/global`;
@@ -35,12 +35,19 @@ module('Unit | Controller | scopes/scope/aliases/index', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/aliases/index');
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.alias = this.server.create('alias', {
scope: instances.scopes.global,
});
@@ -9,7 +9,6 @@ import { visit } from '@ember/test-helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIntl } from 'ember-intl/test-support';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_AUTH_METHOD_PASSWORD } from 'api/models/auth-method';
module(
'Unit | Controller | scopes/scope/auth-methods/auth-method/accounts/index',
@@ -36,24 +35,22 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
intl = this.owner.lookup('service:intl');
controller = this.owner.lookup(
'controller:scopes/scope/auth-methods/auth-method/accounts/index',
);
store = this.owner.lookup('service:store');
instances.scopes.global = this.server.create('scope', {
id: 'global',
type: 'global',
});
instances.authMethod = this.server.create('auth-method', {
scope: instances.scopes.global,
type: TYPE_AUTH_METHOD_PASSWORD,
});
instances.account = this.server.create('account', {
scope: instances.scopes.global,
authMethod: instances.authMethod,
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
instances.authMethod = this.server.schema.authMethods.first();
instances.account = this.server.schema.accounts.first();
await authenticateSession({
isGlobal: true,
account_id: instances.account.id,
});
getAccountCount = () => this.server.schema.accounts.all().models.length;
@@ -36,16 +36,20 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
intl = this.owner.lookup('service:intl');
controller = this.owner.lookup(
'controller:scopes/scope/auth-methods/auth-method/managed-groups/index',
);
store = this.owner.lookup('service:store');
instances.scopes.global = this.server.create('scope', {
id: 'global',
type: 'global',
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.authMethod = this.server.create('auth-method', {
scope: instances.scopes.global,
@@ -29,7 +29,7 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
let getAuthMethodCount;
const instances = {
scope: {
scopes: {
global: null,
},
authMethod: null,
@@ -40,16 +40,21 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/auth-methods/index',
);
instances.scope.global = this.server.create('scope', { id: 'global' });
instances.authMethod = this.server.create('auth-method', {
scope: instances.scope.global,
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
instances.authMethod = this.server.schema.authMethods.first();
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
urls.authMethods = '/scopes/global/auth-methods';
@@ -148,7 +153,7 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
);
await controller.makePrimary(authMethod);
const scope = await store.findRecord('scope', instances.scope.global.id);
const scope = await store.findRecord('scope', instances.scopes.global.id);
assert.strictEqual(scope.primary_auth_method_id, instances.authMethod.id);
});
@@ -161,7 +166,7 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
);
await controller.removeAsPrimary(authMethod);
const scope = await store.findRecord('scope', instances.scope.global.id);
const scope = await store.findRecord('scope', instances.scopes.global.id);
assert.notOk(scope.primary_auth_method_id);
});
@@ -249,7 +254,7 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
});
test('messageDescription returns correct translation with create authorization', async function (assert) {
instances.scope.global.authorized_collection_actions['auth-methods'] = [
instances.scopes.global.authorized_collection_actions['auth-methods'] = [
'create',
];
await visit(urls.authMethods);
@@ -263,7 +268,7 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
});
test('messageDescription returns correct translation with no authorization', async function (assert) {
instances.scope.global.authorized_collection_actions['auth-methods'] = [];
instances.scopes.global.authorized_collection_actions['auth-methods'] = [];
await visit(urls.authMethods);
assert.strictEqual(
@@ -5,18 +5,14 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import { visit } from '@ember/test-helpers';
import { visit, currentURL, settled } from '@ember/test-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 { TYPE_AUTH_METHOD_PASSWORD } from 'api/models/auth-method';
module(
'Unit | Controller | scopes/scope/authenticate/method/index',
function (hooks) {
setupTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let controller;
let store;
@@ -25,8 +21,10 @@ module(
const instances = {
scopes: {
global: null,
org: null,
},
authMethod: null,
account: null,
};
const urls = {
@@ -35,51 +33,56 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
controller = this.owner.lookup(
'controller:scopes/scope/authenticate/method/index',
);
store = this.owner.lookup('service:store');
session = this.owner.lookup('service:session');
instances.scopes.global = this.server.create('scope', {
id: 'global',
type: 'global',
});
instances.authMethod = this.server.create('auth-method', {
scope: instances.scopes.global,
type: TYPE_AUTH_METHOD_PASSWORD,
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
instances.authMethod = this.server.schema.authMethods.first();
instances.account = this.server.schema.accounts.first();
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
});
urls.globalScope = '/scopes/global/scopes';
urls.authenticate = `scopes/global/authenticate/${instances.authMethod}`;
});
test('authenticate action saves login information and redirects to correct page', async function (assert) {
test('authenticate action saves auth information and redirects to correct page', async function (assert) {
await visit(urls.authenticate);
const identification = 'admin123';
const identification = instances.account.attributes.login_name;
const authMethod = await store.findRecord(
'auth-method',
instances.authMethod.id,
);
const { authenticator: authBefore, username: usernameBefore } =
const { authenticator: authBefore, account_id: accountIdBefore } =
session.data.authenticated;
assert.notOk(usernameBefore);
assert.strictEqual(authBefore, 'authenticator:test');
assert.notOk(accountIdBefore);
assert.notOk(authBefore);
assert.ok(identification);
await controller.authenticate(authMethod, {
identification,
password: 'password',
});
const { authenticator: authAfter, username: usernameAfter } =
session.data.authenticated;
await settled();
const { authenticator: authAfter, account_id: accountIdAfter } =
session.data.authenticated;
assert.strictEqual(
authAfter,
`authenticator:${instances.authMethod.type}`,
);
assert.strictEqual(usernameAfter, identification);
assert.strictEqual(accountIdAfter, instances.account.id);
assert.strictEqual(currentURL(), urls.globalScope);
});
},
);
@@ -27,7 +27,6 @@ module(
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -40,14 +39,17 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
intl = intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/credential-stores/credential-store/credential-libraries/index',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
this.server.create('scope', { id: 'global' }, 'withGlobalAuth');
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -27,7 +27,6 @@ module(
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -40,14 +39,17 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/credential-stores/credential-store/credentials/index',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
this.server.create('scope', { id: 'global' }, 'withGlobalAuth');
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -30,7 +30,6 @@ module(
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -42,14 +41,17 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
intl = this.owner.lookup('service:intl');
controller = this.owner.lookup(
'controller:scopes/scope/credential-stores/index',
);
store = this.owner.lookup('service:store');
instances.scopes.global = this.server.create('scope', { id: 'global' });
this.server.create('scope', { id: 'global' }, 'withGlobalAuth');
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -37,13 +37,20 @@ module(
scopes: [{ id: 'global', type: 'global' }],
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/groups/group/add-members',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -35,12 +35,19 @@ module('Unit | Controller | scopes/scope/groups/index', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/groups/index');
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.group = this.server.create('group', {
scope: instances.scopes.global,
});
@@ -22,7 +22,6 @@ module(
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -36,13 +35,16 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/host-catalogs/host-catalog/host-sets/host-set/add-hosts',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
this.server.create('scope', { id: 'global' }, 'withGlobalAuth');
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -22,7 +22,6 @@ module(
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -36,13 +35,16 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/host-catalogs/host-catalog/host-sets/host-set/create-and-add-host',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
this.server.create('scope', { id: 'global' }, 'withGlobalAuth');
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -26,7 +26,6 @@ module(
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -39,14 +38,17 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/host-catalogs/host-catalog/host-sets/index',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
this.server.create('scope', { id: 'global' }, 'withGlobalAuth');
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -25,7 +25,6 @@ module(
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -38,14 +37,17 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/host-catalogs/host-catalog/hosts/index',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
this.server.create('scope', { id: 'global' }, 'withGlobalAuth');
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -26,7 +26,6 @@ module(
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -38,14 +37,17 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/host-catalogs/index',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
this.server.create('scope', { id: 'global' }, 'withGlobalAuth');
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -34,11 +34,14 @@ module('Unit | Controller | scopes/scope/index', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/index');
instances.scopes.global = this.server.create('scope', { id: 'global' });
this.server.create('scope', { id: 'global' }, 'withGlobalAuth');
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -32,12 +32,19 @@ module('Unit | Controller | scopes/scope/policies/index', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/policies/index');
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.policy = this.server.create('policy', {
scopeId: 'global',
});
@@ -36,12 +36,19 @@ module('Unit | Controller | scopes/scope/roles/index', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/roles/index');
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.role = this.server.create('role', {
scope: instances.scopes.global,
});
@@ -38,13 +38,20 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/roles/role/add-principals',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -28,11 +28,18 @@ module('Unit | Controller | scopes/scope/roles/role/grants', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/roles/role/grants');
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.role = this.server.create('role', {
scope: instances.scopes.global,
});
@@ -33,15 +33,22 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/roles/role/manage-scopes/index',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.role = this.server.create('role', {
scopeId: 'global',
scope: instances.scopes.global,
grant_scope_ids: [],
});
@@ -22,7 +22,6 @@ module(
const instances = {
scopes: {
global: null,
org: null,
},
role: null,
@@ -35,13 +34,16 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/roles/role/manage-scopes/manage-custom-scopes',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
this.server.create('scope', { id: 'global' }, 'withGlobalAuth');
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -36,15 +36,19 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/roles/role/manage-scopes/manage-org-projects',
);
instances.scopes.global = this.server.create('scope', {
id: 'global',
type: 'global',
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
@@ -37,10 +37,17 @@ module('Unit | Controller | scopes/scope/roles/role/scopes', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
controller = this.owner.lookup('controller:scopes/scope/roles/role/scopes');
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.role = this.server.create('role', {
scopeId: 'global',
});
@@ -35,7 +35,6 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
intl = this.owner.lookup('service:intl');
features = this.owner.lookup('service:features');
store = this.owner.lookup('service:store');
@@ -43,7 +42,15 @@ module(
'controller:scopes/scope/storage-buckets/index',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.storageBucket = this.server.create('storage-bucket', {
scope: instances.scopes.global,
});
@@ -50,13 +50,20 @@ module('Unit | Controller | scopes/scope/targets/index', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/targets/index');
features = this.owner.lookup('service:features');
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -31,7 +31,6 @@ module(
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -46,13 +45,16 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/targets/target/add-brokered-credential-sources',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
this.server.create('scope', { id: 'global' }, 'withGlobalAuth');
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -22,7 +22,6 @@ module(
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -38,13 +37,16 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/targets/target/add-host-sources',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
this.server.create('scope', { id: 'global' }, 'withGlobalAuth');
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -34,7 +34,6 @@ module(
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -49,13 +48,16 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/targets/target/add-injected-application-credential-sources',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
this.server.create('scope', { id: 'global' }, 'withGlobalAuth');
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -22,7 +22,6 @@ module(
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -36,13 +35,16 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/targets/target/enable-session-recording/create-storage-bucket',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
this.server.create('scope', { id: 'global' }, 'withGlobalAuth');
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -22,7 +22,6 @@ module(
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -35,13 +34,16 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/targets/target/enable-session-recording/index',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
this.server.create('scope', { id: 'global' }, 'withGlobalAuth');
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -35,12 +35,19 @@ module('Unit | Controller | scopes/scope/users/index', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/users/index');
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.user = this.server.create('user', {
scope: instances.scopes.global,
});
@@ -32,13 +32,20 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/users/user/add-accounts',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.user = this.server.create('user', {
scope: instances.scopes.global,
});
@@ -37,12 +37,19 @@ module('Unit | Controller | scopes/scope/workers/index', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
intl = this.owner.lookup('service:intl');
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/workers/index');
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.worker = this.server.create('worker', {
scope: instances.scopes.global,
config_tags: { type: ['dev'] },
@@ -28,11 +28,18 @@ module('Unit | Controller | scopes/scope/workers/new', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup('controller:scopes/scope/workers/new');
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.worker = this.server.create('worker', {
scope: instances.scopes.global,
});
@@ -32,13 +32,20 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/workers/worker/create-tags',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.worker = this.server.create('worker', {
scope: instances.scopes.global,
});
@@ -35,13 +35,20 @@ module(
};
hooks.beforeEach(async function () {
await authenticateSession({});
store = this.owner.lookup('service:store');
controller = this.owner.lookup(
'controller:scopes/scope/workers/worker/tags',
);
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.create(
'scope',
{ id: 'global' },
'withGlobalAuth',
);
await authenticateSession({
isGlobal: true,
account_id: this.server.schema.accounts.first().id,
});
instances.worker = this.server.create('worker', {
scope: instances.scopes.global,
api_tags: apiTags,