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

+2
View File
@@ -75,6 +75,8 @@ export default class ApplicationRoute extends Route {
if (userId && hostUrl) {
await this.sqlite.setup(formatDbName(userId, hostUrl));
}
await this.session.loadAuthenticatedAccount();
}
}
+27
View File
@@ -5,11 +5,15 @@
import BaseSessionService from 'ember-simple-auth/services/session';
import { service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
import { formatDbName } from 'api/services/sqlite';
export default class SessionService extends BaseSessionService {
@service sqlite;
@service('browser/window') window;
@service store;
@tracked username;
/**
* Extend ember simple auth's handleAuthentication method
@@ -22,8 +26,31 @@ export default class SessionService extends BaseSessionService {
await this.sqlite.setup(formatDbName(userId, hostUrl));
}
await this.loadAuthenticatedAccount();
// We let ember-simple-auth handle transitioning back to the index after authentication.
// This route can be configured in our environment config.
super.handleAuthentication(...arguments);
}
/**
* Loads account used to authenticate so that it can be used to display
* the authenticated username.
*/
async loadAuthenticatedAccount() {
if (this.data?.authenticated?.account_id) {
try {
const account = await this.store.findRecord(
'account',
this.data.authenticated.account_id,
);
this.username = account.accountName;
} catch (e) {
// We are purposefully ignoring errors since loading the
// authenticated account should not block a user because
// account information is for populating a username.
console.error(e);
}
}
}
}
+15
View File
@@ -1025,3 +1025,18 @@
.injected-app-credential-alert {
margin-bottom: 1rem;
}
// User menu dropdown in global side nav
.user-menu-dropdown {
max-width: 125px;
&__toggle-button {
width: 100%;
.hds-dropdown-toggle-button__text {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
}
+61 -29
View File
@@ -71,41 +71,73 @@
</Hds::Dropdown>
{{/if}}
<Hds::Dropdown
@enableCollisionDetection={{true}}
data-test-side-nav-user-dropdown
as |dd|
>
{{#if this.session.data.authenticated.username}}
{{#if this.session.username}}
<Hds::Dropdown
@enableCollisionDetection={{true}}
class='user-menu-dropdown'
data-test-side-nav-user-dropdown
as |dd|
>
<dd.ToggleButton
@icon='user'
@text={{this.session.data.authenticated.username}}
@text={{this.session.username}}
{{hds-tooltip this.session.username}}
class='user-menu-dropdown__toggle-button'
/>
{{else}}
<dd.Title @text={{t 'titles.authenticated'}} />
<dd.Description @text={{this.session.username}} />
<dd.Separator />
<dd.Interactive @route='account.change-password'>{{t
'actions.change-password'
}}</dd.Interactive>
<dd.Separator />
<dd.Interactive {{on 'click' this.invalidateSession}}>{{t
'actions.deauthenticate'
}}</dd.Interactive>
<dd.Separator />
<dd.Title @text={{t 'actions.toggle-color-theme'}} />
{{#each this.themes as |theme|}}
<dd.Radio
@value={{theme.value}}
checked={{eq this.session.data.theme theme.value}}
{{on 'change' (fn this.toggleTheme theme.value)}}
>
{{t (concat 'themes.' theme.label)}}
</dd.Radio>
{{/each}}
</Hds::Dropdown>
{{else}}
<Hds::Dropdown
@enableCollisionDetection={{true}}
data-test-side-nav-user-dropdown
as |dd|
>
<dd.ToggleIcon @icon='user' @text={{t 'titles.user-menu'}} />
{{/if}}
<dd.Interactive @route='account.change-password'>{{t
'actions.change-password'
}}</dd.Interactive>
<dd.Separator />
<dd.Interactive @route='account.change-password'>{{t
'actions.change-password'
}}</dd.Interactive>
<dd.Separator />
<dd.Interactive {{on 'click' this.invalidateSession}}>{{t
'actions.deauthenticate'
}}</dd.Interactive>
<dd.Separator />
<dd.Interactive {{on 'click' this.invalidateSession}}>{{t
'actions.deauthenticate'
}}</dd.Interactive>
<dd.Separator />
<dd.Title @text={{t 'actions.toggle-color-theme'}} />
{{#each this.themes as |theme|}}
<dd.Radio
@value={{theme.value}}
checked={{eq this.session.data.theme theme.value}}
{{on 'change' (fn this.toggleTheme theme.value)}}
>
{{t (concat 'themes.' theme.label)}}
</dd.Radio>
{{/each}}
</Hds::Dropdown>
<dd.Title @text={{t 'actions.toggle-color-theme'}} />
{{#each this.themes as |theme|}}
<dd.Radio
@value={{theme.value}}
checked={{eq this.session.data.theme theme.value}}
{{on 'change' (fn this.toggleTheme theme.value)}}
>
{{t (concat 'themes.' theme.label)}}
</dd.Radio>
{{/each}}
</Hds::Dropdown>
{{/if}}
</:actions>
</Hds::SideNav::Header>
</:header>
@@ -6,25 +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,
invalidateSession,
} from 'ember-simple-auth/test-support';
import { invalidateSession } from 'ember-simple-auth/test-support';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | accounts | change password', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
},
account: null,
@@ -35,7 +29,6 @@ module('Acceptance | accounts | change password', 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' },
@@ -46,10 +39,7 @@ module('Acceptance | accounts | change password', function (hooks) {
instances.account = this.server.create('account', {
scope: instances.scopes.org,
});
await authenticateSession({
account_id: instances.account.id,
username: 'admin',
});
// Generate route URLs for resources
urls.orgScope = `/scopes/${instances.scopes.org.id}`;
urls.changePassword = `/account/change-password`;
@@ -6,20 +6,16 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, find, fillIn } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | accounts | create', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const instances = {
scopes: {
global: null,
org: null,
},
authMethods: null,
@@ -36,13 +32,12 @@ module('Acceptance | accounts | create', 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' },
});
instances.authMethod = this.server.create('auth-method', {
type: 'password',
scope: instances.scopes.org,
});
instances.account = this.server.create('account', {
@@ -6,20 +6,16 @@
import { module, test } from 'qunit';
import { visit, click, find } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | accounts | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const instances = {
scopes: {
global: null,
org: null,
},
authMethod: null,
@@ -34,8 +30,6 @@ module('Acceptance | accounts | delete', 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' },
@@ -6,19 +6,15 @@
import { module, test } from 'qunit';
import { visit, click } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | accounts | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const instances = {
scopes: {
global: null,
org: null,
},
authMethod: null,
@@ -33,8 +29,6 @@ module('Acceptance | accounts | list', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -6,18 +6,14 @@
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 { 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 | accounts | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const instances = {
scopes: {
global: null,
org: null,
},
authMethod: null,
@@ -31,8 +27,6 @@ module('Acceptance | accounts | read', 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' },
@@ -6,19 +6,15 @@
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 { 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 | accounts | set password', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const instances = {
scopes: {
global: null,
org: null,
},
authMethod: null,
@@ -32,16 +28,16 @@ module('Acceptance | accounts | set password', 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' },
});
instances.authMethod = this.server.create('auth-method', {
type: 'password',
scope: instances.scopes.org,
});
instances.account = this.server.create('account', {
type: 'password',
scope: instances.scopes.org,
authMethod: instances.authMethod,
});
@@ -6,19 +6,15 @@
import { module, test } from 'qunit';
import { visit, click, fillIn } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
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 | accounts | update', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const instances = {
scopes: {
global: null,
org: null,
},
authMethod: null,
@@ -32,8 +28,6 @@ module('Acceptance | accounts | update', 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' },
@@ -69,7 +63,7 @@ module('Acceptance | accounts | update', function (hooks) {
await click(commonSelectors.SAVE_BTN);
assert.strictEqual(
this.server.schema.accounts.all().models[0].name,
this.server.schema.accounts.find(instances.account.id).name,
commonSelectors.FIELD_NAME_VALUE,
);
});
@@ -95,11 +89,11 @@ module('Acceptance | accounts | update', function (hooks) {
await click(commonSelectors.SAVE_BTN);
assert.strictEqual(
this.server.schema.accounts.all().models[0].name,
this.server.schema.accounts.find(instances.account.id).name,
commonSelectors.FIELD_NAME_VALUE,
);
assert.strictEqual(
this.server.schema.accounts.all().models[0].description,
this.server.schema.accounts.find(instances.account.id).description,
commonSelectors.FIELD_DESCRIPTION_VALUE,
);
});
@@ -6,9 +6,7 @@
import { module, test } from 'qunit';
import { click, currentURL, fillIn, visit } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { setupSqlite } from 'api/test-support/helpers/sqlite';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
@@ -16,7 +14,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | aliases | create', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let features;
@@ -35,14 +32,13 @@ module('Acceptance | aliases | create', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
urls.globalScope = `/scopes/global`;
urls.aliases = `${urls.globalScope}/aliases`;
urls.newAlias = `${urls.aliases}/new`;
getAliasCount = () => this.server.schema.aliases.all().models.length;
features = this.owner.lookup('service:features');
features.enable('ssh-session-recording');
await authenticateSession({ username: 'admin' });
});
test('users can create a new alias with host and target info', async function (assert) {
@@ -6,15 +6,12 @@
import { module, test } from 'qunit';
import { click, visit } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { setupSqlite } from 'api/test-support/helpers/sqlite';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | aliases | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let aliasCount;
@@ -36,8 +33,7 @@ module('Acceptance | aliases | delete', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -6,9 +6,7 @@
import { module, test } from 'qunit';
import { visit, click, currentURL, waitFor, 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 { 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';
@@ -16,7 +14,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | aliases | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let intl;
@@ -41,7 +38,7 @@ module('Acceptance | aliases | list', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -66,8 +63,6 @@ module('Acceptance | aliases | list', function (hooks) {
urls.alias = `${urls.aliases}/${instances.alias.id}`;
urls.aliasWithTarget = `${urls.aliases}/${instances.aliasWithTarget.id}`;
intl = this.owner.lookup('service:intl');
await authenticateSession({});
});
test('users can navigate to aliases with proper authorization', async function (assert) {
@@ -6,15 +6,12 @@
import { module, test } from 'qunit';
import { click, currentURL, visit } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { setupSqlite } from 'api/test-support/helpers/sqlite';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | aliases | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
@@ -33,7 +30,7 @@ module('Acceptance | aliases | read', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -45,8 +42,6 @@ module('Acceptance | aliases | read', function (hooks) {
urls.aliases = `${urls.globalScope}/aliases`;
urls.alias = `${urls.aliases}/${instances.alias.id}`;
urls.unknownAlias = `${urls.aliases}/foo`;
await authenticateSession({ username: 'admin' });
});
test('visiting an alias', async function (assert) {
@@ -6,15 +6,12 @@
import { module, test } from 'qunit';
import { click, fillIn, visit } 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 | aliases | update', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let aliasCount;
@@ -37,7 +34,7 @@ module('Acceptance | aliases | update', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -53,11 +50,9 @@ module('Acceptance | aliases | update', function (hooks) {
urls.aliases = `${urls.globalScope}/aliases`;
urls.alias = `${urls.aliases}/${instances.alias.id}`;
aliasCount = () => this.server.schema.aliases.all().models.length;
await authenticateSession({});
});
test('users can update an exisiting alias', async function (assert) {
test('users can update an existing alias', async function (assert) {
setRunOptions({
rules: {
'color-contrast': {
@@ -6,17 +6,14 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn, select } 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 | auth-methods | create', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let getAuthMethodsCount;
@@ -24,7 +21,6 @@ module('Acceptance | auth-methods | create', function (hooks) {
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -41,7 +37,6 @@ module('Acceptance | auth-methods | create', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
instances.orgScope = this.server.create(
'scope',
{
@@ -6,10 +6,8 @@
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 { TYPE_AUTH_METHOD_LDAP } from 'api/models/auth-method';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
@@ -17,7 +15,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | auth-methods | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let featuresService;
@@ -25,7 +22,6 @@ module('Acceptance | auth-methods | delete', function (hooks) {
const instances = {
scopes: {
global: null,
org: null,
},
authMethod: null,
@@ -40,8 +36,6 @@ module('Acceptance | auth-methods | delete', function (hooks) {
hooks.beforeEach(async function () {
// Setup Mirage mock resources for this test
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' },
@@ -6,9 +6,7 @@
import { module, test } from 'qunit';
import { visit, click, waitFor, fillIn, 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 { faker } from '@faker-js/faker';
import {
TYPE_AUTH_METHOD_PASSWORD,
@@ -20,12 +18,10 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | auth-methods | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
},
passwordAuthMethod: null,
@@ -41,7 +37,6 @@ module('Acceptance | auth-methods | list', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create(
'scope',
{
@@ -63,8 +58,6 @@ module('Acceptance | auth-methods | list', function (hooks) {
urls.authMethods = `/scopes/${instances.scopes.org.id}/auth-methods`;
urls.passwordAuthMethod = `${urls.authMethods}/${instances.passwordAuthMethod.id}`;
urls.oidcAuthMethod = `${urls.authMethods}/${instances.oidcAuthMethod.id}`;
await authenticateSession({});
});
test('users can navigate to auth methods with proper authorization', async function (assert) {
@@ -6,19 +6,15 @@
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 { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_AUTH_METHOD_OIDC } from 'api/models/auth-method';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
module('Acceptance | auth-methods | oidc', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const instances = {
scopes: {
global: null,
org: null,
},
authMethod: null,
@@ -30,8 +26,6 @@ module('Acceptance | auth-methods | oidc', 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' },
@@ -6,9 +6,7 @@
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 {
TYPE_AUTH_METHOD_LDAP,
TYPE_AUTH_METHOD_OIDC,
@@ -20,7 +18,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | auth-methods | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
@@ -44,8 +41,7 @@ module('Acceptance | auth-methods | read', function (hooks) {
hooks.beforeEach(async function () {
// Setup Mirage mock resources for this test
await authenticateSession({ username: 'admin' });
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -6,10 +6,8 @@
import { module, test } from 'qunit';
import { visit, click, fillIn, select, findAll } 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_OIDC,
TYPE_AUTH_METHOD_LDAP,
@@ -20,14 +18,12 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | auth-methods | update', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let featuresService;
const instances = {
scopes: {
global: null,
org: null,
},
authMethod: null,
@@ -43,8 +39,6 @@ module('Acceptance | auth-methods | update', function (hooks) {
hooks.beforeEach(async function () {
// Setup Mirage mock resources for this test
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' },
@@ -89,7 +83,7 @@ module('Acceptance | auth-methods | update', function (hooks) {
await click(commonSelectors.SAVE_BTN);
assert.strictEqual(
this.server.schema.authMethods.first().name,
this.server.schema.authMethods.find(instances.authMethod.id).name,
commonSelectors.FIELD_NAME_VALUE,
);
});
@@ -12,7 +12,6 @@ import {
getRootElement,
} 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 { setupIntl } from 'ember-intl/test-support';
import { Response } from 'miragejs';
@@ -30,7 +29,6 @@ import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | authentication', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
setupIntl(hooks, 'en-us');
@@ -43,8 +41,10 @@ module('Acceptance | authentication', function (hooks) {
let orgScopeURL;
let scope;
let globalAuthMethod;
let globalAccount;
let globalAuthMethodID;
let authMethod;
let account;
let authMethodID;
let authMethodOIDC;
let authMethodOIDCID;
@@ -69,7 +69,9 @@ module('Acceptance | authentication', function (hooks) {
hooks.beforeEach(async function () {
await invalidateSession();
indexURL = '/';
globalScope = this.server.create('scope', { id: 'global' });
globalScope = this.server.schema.scopes.find('global');
globalAuthMethod = this.server.schema.authMethods.first();
globalAccount = this.server.schema.accounts.first();
orgScope1 = this.server.create(
'scope',
{
@@ -96,18 +98,22 @@ module('Acceptance | authentication', function (hooks) {
'withChildren',
);
scope = { id: orgScope1.id, type: orgScope1.type };
globalAuthMethod = this.server.create('auth-method', {
scope: globalScope,
type: TYPE_AUTH_METHOD_PASSWORD,
});
authMethod = this.server.create('auth-method', {
scope: orgScope1,
type: TYPE_AUTH_METHOD_PASSWORD,
});
account = this.server.create('account', {
scope: orgScope1,
authMethod,
});
authMethodOIDC = this.server.create('auth-method', {
scope: orgScope2,
type: TYPE_AUTH_METHOD_OIDC,
});
this.server.create('account', {
scope: orgScope2,
authMethod: authMethodOIDC,
});
orgScopeID = orgScope1.id;
globalAuthMethodID = globalAuthMethod.id;
authMethodID = authMethod.id;
@@ -250,7 +256,7 @@ module('Acceptance | authentication', function (hooks) {
});
test('visiting any authentication parent route while already authenticated with an org redirects to projects', async function (assert) {
await authenticateSession({ scope });
await authenticateSession({ scope, account_id: account.id });
await visit(indexURL);
assert.strictEqual(currentURL(), projectsURL);
@@ -276,6 +282,7 @@ module('Acceptance | authentication', function (hooks) {
test('visiting index or scopes routes while already authenticated with global redirects to orgs', async function (assert) {
await authenticateSession({
scope: { id: globalScope.id, type: globalScope.type },
account_id: globalAccount.id,
});
await visit(indexURL);
@@ -340,6 +347,7 @@ module('Acceptance | authentication', function (hooks) {
test('401 responses result in deauthentication', async function (assert) {
await authenticateSession({
scope: { id: globalScope.id, type: globalScope.type },
account_id: globalAccount.id,
});
await visit(orgsURL);
@@ -360,6 +368,7 @@ module('Acceptance | authentication', function (hooks) {
test('color theme is applied from session data', async function (assert) {
await authenticateSession({
scope: { id: globalScope.id, type: globalScope.type },
account_id: globalAccount.id,
});
currentSession().set('data.theme', 'light');
await visit(orgsURL);
@@ -6,9 +6,7 @@
import { module, test } from 'qunit';
import { visit, click, fillIn, currentURL, select } 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 { Response } from 'miragejs';
import {
TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE,
@@ -21,7 +19,6 @@ import { TYPE_CREDENTIAL_USERNAME_PASSWORD_DOMAIN } from 'api/models/credential'
module('Acceptance | credential-libraries | create', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let featuresService;
@@ -30,7 +27,6 @@ module('Acceptance | credential-libraries | create', function (hooks) {
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -49,7 +45,6 @@ module('Acceptance | credential-libraries | create', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -83,7 +78,6 @@ module('Acceptance | credential-libraries | create', function (hooks) {
credentialType: TYPE_CREDENTIAL_USERNAME_PASSWORD_DOMAIN,
}).length;
};
await authenticateSession({ username: 'admin' });
featuresService = this.owner.lookup('service:features');
});
@@ -6,9 +6,7 @@
import { module, test } from 'qunit';
import { visit, 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 { Response } from 'miragejs';
import { resolve, reject } from 'rsvp';
import sinon from 'sinon';
@@ -23,7 +21,6 @@ import { TYPE_CREDENTIAL_USERNAME_PASSWORD_DOMAIN } from 'api/models/credential'
module('Acceptance | credential-libraries | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let getCredentialLibraryCount;
@@ -32,7 +29,6 @@ module('Acceptance | credential-libraries | delete', function (hooks) {
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -51,7 +47,6 @@ module('Acceptance | credential-libraries | delete', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -106,7 +101,6 @@ module('Acceptance | credential-libraries | delete', function (hooks) {
type: TYPE_CREDENTIAL_LIBRARY_VAULT_LDAP,
}).length;
};
await authenticateSession({});
});
test('can delete resource', async function (assert) {
@@ -6,22 +6,18 @@
import { module, test } from 'qunit';
import { visit } 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 { TYPE_CREDENTIAL_LIBRARY_VAULT_LDAP } from 'api/models/credential-library';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | credential-libraries | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let featuresService;
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -35,7 +31,6 @@ module('Acceptance | credential-libraries | 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' },
@@ -64,7 +59,6 @@ module('Acceptance | credential-libraries | list', function (hooks) {
urls.credentialStore = `${urls.credentialStores}/${instances.credentialStore.id}`;
urls.credentialLibraries = `${urls.credentialStore}/credential-libraries`;
urls.vaultLDAPCredentialLibrary = `${urls.credentialLibraries}/${instances.vaultLDAPCredentialLibrary.id}`;
await authenticateSession({});
featuresService = this.owner.lookup('service:features');
});
@@ -6,9 +6,7 @@
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 { authenticateSession } from 'ember-simple-auth/test-support';
import {
TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE,
TYPE_CREDENTIAL_LIBRARY_VAULT_GENERIC,
@@ -20,12 +18,10 @@ import { TYPE_CREDENTIAL_USERNAME_PASSWORD_DOMAIN } from 'api/models/credential'
module('Acceptance | credential-libraries | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -46,7 +42,6 @@ module('Acceptance | credential-libraries | read', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -72,7 +67,6 @@ module('Acceptance | credential-libraries | read', function (hooks) {
urls.credentialLibrary = `${urls.credentialLibraries}/${instances.credentialLibrary.id}`;
urls.newCredentialLibrary = `${urls.credentialLibraries}/new`;
urls.unknownCredentialLibrary = `${urls.credentialLibraries}/foo`;
await authenticateSession({ username: 'admin' });
});
test('can navigate to resource', async function (assert) {
@@ -6,9 +6,7 @@
import { module, test } from 'qunit';
import { visit, click, fillIn, currentURL, select } 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 { Response } from 'miragejs';
import {
TYPE_CREDENTIAL_LIBRARY_VAULT_SSH_CERTIFICATE,
@@ -22,12 +20,10 @@ import { TYPE_CREDENTIAL_USERNAME_PASSWORD_DOMAIN } from 'api/models/credential'
module('Acceptance | credential-libraries | update', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -48,7 +44,6 @@ module('Acceptance | credential-libraries | update', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -93,7 +88,6 @@ module('Acceptance | credential-libraries | update', function (hooks) {
urls.unknownCredentialLibrary = `${urls.credentialLibraries}/foo`;
urls.usernamePasswordDomainCredentialLibrary = `${urls.credentialLibraries}/${instances.usernamePasswordDomainCredentialLibrary.id}`;
urls.vaultLDAPCredentialLibrary = `${urls.credentialLibraries}/${instances.vaultLDAPCredentialLibrary.id}`;
await authenticateSession({});
});
test('cannot update resource without proper authorization', async function (assert) {
@@ -6,9 +6,7 @@
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 { authenticateSession } from 'ember-simple-auth/test-support';
import { Response } from 'miragejs';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
@@ -16,7 +14,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | credential-stores | create', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let featuresService;
@@ -26,7 +23,6 @@ module('Acceptance | credential-stores | create', function (hooks) {
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -39,7 +35,6 @@ module('Acceptance | credential-stores | create', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -63,7 +58,6 @@ module('Acceptance | credential-stores | create', function (hooks) {
return this.server.schema.credentialStores.where({ type: 'vault' }).models
.length;
};
await authenticateSession({});
featuresService = this.owner.lookup('service:features');
});
@@ -6,9 +6,7 @@
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 { authenticateSession } from 'ember-simple-auth/test-support';
import { Response } from 'miragejs';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
@@ -18,7 +16,6 @@ module(
'Acceptance | credential-stores | credentials | create',
function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let getCredentialsCount;
@@ -86,7 +83,6 @@ module(
type: 'username_password_domain',
}).length;
};
await authenticateSession({});
});
test('users can create a new username & password credential', async function (assert) {
@@ -5,9 +5,7 @@
import { module, test } from 'qunit';
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 { click, currentURL, visit } from '@ember/test-helpers';
import { Response } from 'miragejs';
import * as selectors from './selectors';
@@ -23,7 +21,6 @@ module(
'Acceptance | credential-stores | credentials | delete',
function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let getUsernamePasswordCredentialCount;
@@ -127,7 +124,6 @@ module(
type: TYPE_CREDENTIAL_USERNAME_PASSWORD_DOMAIN,
}).length;
};
await authenticateSession({});
});
test('can delete username & password credential', async function (assert) {
@@ -6,16 +6,13 @@
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 { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as credentialStoreSelectors from '../selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | credential-stores | credentials | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
@@ -72,7 +69,6 @@ module('Acceptance | credential-stores | credentials | list', function (hooks) {
urls.staticCredentialStore = `${urls.credentialStores}/${instances.staticCredentialStore.id}`;
urls.credentials = `${urls.staticCredentialStore}/credentials`;
urls.newCredential = `${urls.staticCredentialStore}/credentials/new`;
await authenticateSession({});
});
test('Users can navigate to credentials with proper authorization', async function (assert) {
@@ -6,15 +6,12 @@
import { module, test } from 'qunit';
import { visit, currentURL, find, 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 | credential-stores | credentials | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let featuresService;
@@ -91,7 +88,6 @@ module('Acceptance | credential-stores | credentials | read', function (hooks) {
urls.jsonCredential = `${urls.credentials}/${instances.jsonCredential.id}`;
urls.usernamePasswordDomainCredential = `${urls.credentials}/${instances.usernamePasswordDomainCredential.id}`;
urls.unknownCredential = `${urls.credentials}/foo`;
await authenticateSession({ username: 'admin' });
featuresService = this.owner.lookup('service:features');
});
@@ -13,10 +13,8 @@ import {
waitUntil,
} 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 selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
@@ -25,14 +23,12 @@ module(
'Acceptance | credential-stores | credentials | update',
function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let featuresService;
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -78,7 +74,6 @@ module(
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -126,7 +121,6 @@ module(
urls.usernamePasswordDomainCredential = `${urls.credentials}/${instances.usernamePasswordDomainCredential.id}`;
featuresService = this.owner.lookup('service:features');
await authenticateSession({});
});
test('can save changes to existing username & password credential', async function (assert) {
@@ -6,9 +6,7 @@
import { module, test } from 'qunit';
import { visit, 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 { Response } from 'miragejs';
import { resolve, reject } from 'rsvp';
import sinon from 'sinon';
@@ -18,7 +16,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | credential-stores | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let getStaticCredentialStoresCount;
@@ -26,7 +23,6 @@ module('Acceptance | credential-stores | delete', function (hooks) {
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -40,7 +36,6 @@ module('Acceptance | credential-stores | delete', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -70,7 +65,6 @@ module('Acceptance | credential-stores | delete', function (hooks) {
return this.server.schema.credentialStores.where({ type: 'vault' }).models
.length;
};
await authenticateSession({});
});
test('can delete credential store of type vault', async function (assert) {
@@ -6,9 +6,7 @@
import { module, test } from 'qunit';
import { click, currentURL, fillIn, visit, waitFor } 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 { faker } from '@faker-js/faker';
import {
TYPE_CREDENTIAL_STORE_STATIC,
@@ -20,12 +18,10 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | credential-stores | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -42,7 +38,6 @@ module('Acceptance | credential-stores | 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' },
@@ -67,7 +62,6 @@ module('Acceptance | credential-stores | list', function (hooks) {
const featuresService = this.owner.lookup('service:features');
featuresService.enable('static-credentials');
await authenticateSession({});
});
test('users can navigate to credential-stores with proper authorization', async function (assert) {
@@ -6,22 +6,18 @@
import { module, test } from 'qunit';
import { click, currentURL, visit } 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 | credential-stores | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let featuresService;
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -39,7 +35,6 @@ module('Acceptance | credential-stores | read', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -63,7 +58,6 @@ module('Acceptance | credential-stores | read', function (hooks) {
urls.vaultCredentialStore = `${urls.credentialStores}/${instances.vaultCredentialStore.id}`;
urls.unknownCredentialStore = `${urls.credentialStores}/foo`;
await authenticateSession({ username: 'admin' });
featuresService = this.owner.lookup('service:features');
});
@@ -6,9 +6,7 @@
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 { authenticateSession } from 'ember-simple-auth/test-support';
import { Response } from 'miragejs';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
@@ -16,12 +14,10 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | credential-stores | update', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -36,7 +32,6 @@ module('Acceptance | credential-stores | update', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
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 | credential-stores | update', function (hooks) {
urls.staticCredentialStore = `${urls.credentialStores}/${instances.staticCredentialStore.id}`;
urls.workerFilter = `${urls.credentialStores}/${instances.vaultCredentialStore.id}/worker-filter`;
urls.editWorkerFilter = `${urls.credentialStores}/${instances.vaultCredentialStore.id}/edit-worker-filter`;
await authenticateSession({});
// Enable feature flag
const featuresService = this.owner.lookup('service:features');
@@ -6,13 +6,10 @@
import { module, test } from 'qunit';
import { visit, getContext } 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';
module('Acceptance | develop', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let featuresService;
@@ -21,12 +18,10 @@ module('Acceptance | develop', function (hooks) {
hooks.beforeEach(async function () {
const { owner } = getContext();
featuresService = owner.lookup('service:features');
this.server.create('scope', { id: 'global' });
this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
});
await authenticateSession({});
});
test('edition toggle is hidden when `dev-edition-toggle` is false', 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';
module('Acceptance | groups | create', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let groupsCount;
@@ -33,7 +30,6 @@ module('Acceptance | groups | create', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
instances.scopes.org = this.server.create(
'scope',
{
@@ -6,22 +6,18 @@
import { module, test } from 'qunit';
import { visit, click } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
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 | groups | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
let getGroupsCount;
const instances = {
scopes: {
global: null,
org: null,
},
group: null,
@@ -34,8 +30,6 @@ module('Acceptance | groups | delete', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -13,15 +13,12 @@ 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 { faker } from '@faker-js/faker';
module('Acceptance | groups | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const SEARCH_INPUT_SELECTOR = '.search-filtering [type="search"]';
@@ -29,7 +26,6 @@ module('Acceptance | groups | list', function (hooks) {
const instances = {
scopes: {
global: null,
org: null,
},
group1: null,
@@ -44,7 +40,6 @@ module('Acceptance | groups | list', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create(
'scope',
{
@@ -64,7 +59,6 @@ module('Acceptance | groups | list', function (hooks) {
urls.groups = `/scopes/${instances.scopes.org.id}/groups`;
urls.group1 = `${urls.groups}/${instances.group1.id}`;
urls.group2 = `${urls.groups}/${instances.group2.id}`;
await authenticateSession({});
});
test('can navigate to groups with proper authorization', async function (assert) {
@@ -6,22 +6,18 @@
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 * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | groups | members', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
},
group: null,
@@ -36,8 +32,6 @@ module('Acceptance | groups | members', function (hooks) {
let membersCount;
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' },
@@ -6,20 +6,16 @@
import { module, test } from 'qunit';
import { visit, 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 { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | groups | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
},
group: null,
@@ -32,8 +28,6 @@ module('Acceptance | groups | read', 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' },
@@ -6,14 +6,11 @@
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 { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | groups | update', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const instances = {
scopes: {
@@ -30,8 +27,6 @@ module('Acceptance | groups | update', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -6,9 +6,7 @@
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 { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { setupSqlite } from 'api/test-support/helpers/sqlite';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
@@ -16,7 +14,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | host-catalogs | create', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let featuresService;
@@ -25,7 +22,6 @@ module('Acceptance | host-catalogs | create', function (hooks) {
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -46,7 +42,6 @@ module('Acceptance | host-catalogs | create', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.orgScope = this.server.create(
'scope',
{
@@ -85,8 +80,6 @@ module('Acceptance | host-catalogs | create', function (hooks) {
// Generate resource counter
getHostCatalogCount = () =>
this.server.schema.hostCatalogs.all().models.length;
await authenticateSession({});
});
test('Users can create new static host catalogs', async function (assert) {
@@ -6,9 +6,7 @@
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 { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { setupSqlite } from 'api/test-support/helpers/sqlite';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import {
@@ -20,14 +18,12 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | host-catalogs | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let getHostCatalogCount;
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -45,7 +41,6 @@ module('Acceptance | host-catalogs | delete', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -74,7 +69,6 @@ module('Acceptance | host-catalogs | delete', function (hooks) {
// Generate resource counter
getHostCatalogCount = () =>
this.server.schema.hostCatalogs.all().models.length;
await authenticateSession({});
});
test('can delete host catalog', async function (assert) {
@@ -6,17 +6,14 @@
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 * as selectors from './selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | host-catalogs | host sets | create', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let getHostSetCount;
@@ -44,7 +41,6 @@ module('Acceptance | host-catalogs | host sets | create', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -72,7 +68,6 @@ module('Acceptance | host-catalogs | host sets | create', function (hooks) {
urls.newHostSet = `${urls.hostSets}/new`;
// Generate resource counter
getHostSetCount = () => this.server.schema.hostSets.all().models.length;
await authenticateSession({});
});
test('can create new host sets', async function (assert) {
@@ -6,26 +6,22 @@
import { module, test } from 'qunit';
import { visit, 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 { resolve, reject } from 'rsvp';
import sinon from 'sinon';
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 | host-catalogs | host sets | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let getHostSetCount;
const instances = {
scopes: {
global: null,
org: null,
project: null,
hostCatalog: null,
@@ -46,7 +42,6 @@ module('Acceptance | host-catalogs | host sets | delete', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -72,9 +67,8 @@ module('Acceptance | host-catalogs | host sets | delete', function (hooks) {
urls.hostSet = `${urls.hostSets}/${instances.hostSet.id}`;
urls.unknownHostSet = `${urls.hostSets}/foo`;
urls.newHostSet = `${urls.hostSets}/new`;
// Generate resource couner
// Generate resource counter
getHostSetCount = () => this.server.schema.hostSets.all().models.length;
await authenticateSession({});
});
test('can delete host', async function (assert) {
@@ -6,24 +6,20 @@
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 * as selectors from './selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | host-catalogs | host-sets | hosts', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let getHostSetHostCount;
const instances = {
scopes: {
global: null,
org: null,
project: null,
hostCatalog: null,
@@ -45,7 +41,6 @@ module('Acceptance | host-catalogs | host-sets | hosts', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -76,7 +71,6 @@ module('Acceptance | host-catalogs | host-sets | hosts', function (hooks) {
// Generate resource counter
getHostSetHostCount = () =>
this.server.schema.hostSets.all().models[0].hosts.length;
await authenticateSession({ username: 'admin' });
});
test('visiting host set hosts', async function (assert) {
@@ -6,19 +6,15 @@
import { module, test } from 'qunit';
import { visit } 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';
module('Acceptance | host-catalogs | host sets | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
hostCatalog: null,
@@ -38,7 +34,6 @@ module('Acceptance | host-catalogs | host sets | list', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -63,7 +58,6 @@ module('Acceptance | host-catalogs | host sets | list', function (hooks) {
urls.hostSets = `${urls.hostCatalog}/host-sets`;
urls.hostSet = `${urls.hostSets}/${instances.hostSet.id}`;
urls.newHostSet = `${urls.hostSets}/new`;
await authenticateSession({});
});
test('Users can navigate to host-sets with proper authorization', async function (assert) {
@@ -6,20 +6,16 @@
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 | host-catalogs | host-sets | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -40,7 +36,6 @@ module('Acceptance | host-catalogs | host-sets | read', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -65,8 +60,6 @@ module('Acceptance | host-catalogs | host-sets | read', function (hooks) {
urls.hostSets = `${urls.hostCatalog}/host-sets`;
urls.hostSet = `${urls.hostSets}/${instances.hostSet.id}`;
urls.unknownHostSet = `${urls.hostSets}/foo`;
await authenticateSession({ username: 'admin' });
});
test('visiting host sets', async function (assert) {
@@ -13,22 +13,18 @@ import {
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 * as selectors from './selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | host-catalogs | host sets | update', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
hostCatalog: null,
@@ -55,7 +51,6 @@ module('Acceptance | host-catalogs | host sets | update', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -109,8 +104,6 @@ module('Acceptance | host-catalogs | host sets | update', function (hooks) {
urls.newHostSet = `${urls.hostSets}/new`;
urls.awshostSet = `${urls.hostCatalogs}/${instances.awsHostCatalog.id}/host-sets/${instances.awsHostSet.id}`;
urls.azureHostSet = `${urls.hostCatalogs}/${instances.azureHostCatalog.id}/host-sets/${instances.azureHostSet.id}`;
// Generate resource couner
await authenticateSession({});
});
test('saving a new host set with invalid fields displays error messages', async function (assert) {
@@ -6,24 +6,20 @@
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 selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | host-catalogs | hosts | create', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let getHostCount;
const instances = {
scopes: {
global: null,
org: null,
project: null,
hostCatalog: null,
@@ -44,7 +40,6 @@ module('Acceptance | host-catalogs | hosts | create', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -71,9 +66,8 @@ module('Acceptance | host-catalogs | hosts | create', function (hooks) {
urls.host = `${urls.hosts}/${instances.host.id}`;
urls.unknownHost = `${urls.hosts}/foo`;
urls.newHost = `${urls.hosts}/new`;
// Generate resource couner
// Generate resource counter
getHostCount = () => this.server.schema.hosts.all().models.length;
await authenticateSession({});
});
test('can create new host', async function (assert) {
@@ -6,26 +6,22 @@
import { module, test } from 'qunit';
import { visit, 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 { resolve, reject } from 'rsvp';
import sinon from 'sinon';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | host-catalogs | hosts | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let getHostCount;
const instances = {
scopes: {
global: null,
org: null,
project: null,
hostCatalog: null,
@@ -46,7 +42,6 @@ module('Acceptance | host-catalogs | hosts | delete', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -72,9 +67,8 @@ module('Acceptance | host-catalogs | hosts | delete', function (hooks) {
urls.host = `${urls.hosts}/${instances.host.id}`;
urls.unknownHost = `${urls.hosts}/foo`;
urls.newHost = `${urls.hosts}/new`;
// Generate resource couner
// Generate resource counter
getHostCount = () => this.server.schema.hosts.all().models.length;
await authenticateSession({});
});
test('can delete host', async function (assert) {
@@ -6,21 +6,17 @@
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 { authenticateSession } from 'ember-simple-auth/test-support';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | host-catalogs | hosts | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
hostCatalog: null,
@@ -41,7 +37,6 @@ module('Acceptance | host-catalogs | hosts | list', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -67,7 +62,6 @@ module('Acceptance | host-catalogs | hosts | list', function (hooks) {
urls.host = `${urls.hosts}/${instances.host.id}`;
urls.unknownHost = `${urls.hosts}/foo`;
urls.newHost = `${urls.hosts}/new`;
await authenticateSession({});
});
test('Users can navigate to hosts with proper authorization', async function (assert) {
@@ -6,20 +6,16 @@
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 | host-catalogs | hosts | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -40,7 +36,6 @@ module('Acceptance | host-catalogs | hosts | read', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -65,8 +60,6 @@ module('Acceptance | host-catalogs | hosts | read', function (hooks) {
urls.hosts = `${urls.hostCatalog}/hosts`;
urls.host = `${urls.hosts}/${instances.host.id}`;
urls.unknownHost = `${urls.hosts}/foo`;
await authenticateSession({ username: 'admin' });
});
test('visiting hosts', async function (assert) {
@@ -6,22 +6,18 @@
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 selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | host-catalogs | hosts | update', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
hostCatalog: null,
@@ -42,7 +38,6 @@ module('Acceptance | host-catalogs | hosts | update', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -68,8 +63,6 @@ module('Acceptance | host-catalogs | hosts | update', function (hooks) {
urls.host = `${urls.hosts}/${instances.host.id}`;
urls.unknownHost = `${urls.hosts}/foo`;
urls.newHost = `${urls.hosts}/new`;
// Generate resource couner
await authenticateSession({});
});
test('can save changes to existing host', async function (assert) {
@@ -6,9 +6,7 @@
import { module, test } from 'qunit';
import { click, currentURL, fillIn, visit, waitFor } 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 {
TYPE_HOST_CATALOG_DYNAMIC,
TYPE_HOST_CATALOG_PLUGIN_AWS,
@@ -23,12 +21,10 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | host-catalogs | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -48,7 +44,6 @@ module('Acceptance | host-catalogs | 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' },
@@ -85,8 +80,6 @@ module('Acceptance | host-catalogs | list', function (hooks) {
urls.awsHostCatalog = `${urls.hostCatalogs}/${instances.awsHostCatalog.id}`;
urls.azureHostCatalog = `${urls.hostCatalogs}/${instances.azureHostCatalog.id}`;
urls.gcpHostCatalog = `${urls.hostCatalogs}/${instances.gcpHostCatalog.id}`;
await authenticateSession({});
});
test('user can navigate to host catalogs with proper authorization', async function (assert) {
@@ -6,20 +6,16 @@
import { module, test } from 'qunit';
import { click, currentURL, visit } 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 | host-catalogs | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -36,7 +32,6 @@ module('Acceptance | host-catalogs | read', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -55,8 +50,6 @@ module('Acceptance | host-catalogs | read', function (hooks) {
urls.hostCatalogs = `${urls.projectScope}/host-catalogs`;
urls.hostCatalog = `${urls.hostCatalogs}/${instances.hostCatalog.id}`;
urls.unknownHostCatalog = `${urls.hostCatalogs}/foo`;
await authenticateSession({ username: 'admin' });
});
test('visiting host catalogs', async function (assert) {
@@ -6,10 +6,8 @@
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 {
TYPE_HOST_CATALOG_DYNAMIC,
@@ -21,12 +19,10 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | host-catalogs | update', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -45,7 +41,6 @@ module('Acceptance | host-catalogs | update', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -80,7 +75,6 @@ module('Acceptance | host-catalogs | update', function (hooks) {
urls.hostCatalog = `${urls.hostCatalogs}/${instances.hostCatalog.id}`;
urls.AWSHostCatalogWithStaticCredential = `${urls.hostCatalogs}/${instances.AWSHostCatalogWithStaticCredential.id}`;
urls.GCPHostCatalog = `${urls.hostCatalogs}/${instances.GCPHostCatalog.id}`;
await authenticateSession({});
});
test('can update static AWS credentials to Dynamic AWS credentials', async function (assert) {
@@ -6,9 +6,7 @@
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 { authenticateSession } from 'ember-simple-auth/test-support';
import { Response } from 'miragejs';
import {
TYPE_AUTH_METHOD_OIDC,
@@ -20,7 +18,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | managed-groups | create', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let getManagedGroupCount;
@@ -28,7 +25,6 @@ module('Acceptance | managed-groups | create', function (hooks) {
const instances = {
scopes: {
global: null,
org: null,
},
authMethod: null,
@@ -45,8 +41,6 @@ module('Acceptance | managed-groups | create', 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' },
@@ -6,8 +6,6 @@
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 { authenticateSession } from 'ember-simple-auth/test-support';
import { Response } from 'miragejs';
import {
TYPE_AUTH_METHOD_OIDC,
@@ -19,13 +17,11 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | managed-groups | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
let getManagedGroupCount;
const instances = {
scopes: {
global: null,
org: null,
},
authMethod: null,
@@ -45,8 +41,6 @@ module('Acceptance | managed-groups | delete', 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' },
@@ -6,9 +6,7 @@
import { module, test } from 'qunit';
import { visit, 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 {
TYPE_AUTH_METHOD_OIDC,
TYPE_AUTH_METHOD_LDAP,
@@ -19,7 +17,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | managed-groups | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let featuresService;
@@ -44,8 +41,6 @@ module('Acceptance | managed-groups | list', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -6,18 +6,14 @@
import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { TYPE_AUTH_METHOD_OIDC } from 'api/models/auth-method';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | managed-groups | members', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const instances = {
scopes: {
global: null,
org: null,
},
authMethod: null,
@@ -33,8 +29,6 @@ module('Acceptance | managed-groups | members', 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' },
@@ -6,8 +6,6 @@
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 { authenticateSession } from 'ember-simple-auth/test-support';
import {
TYPE_AUTH_METHOD_OIDC,
TYPE_AUTH_METHOD_LDAP,
@@ -17,11 +15,9 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | managed-groups | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const instances = {
scopes: {
global: null,
org: null,
},
authMethod: null,
@@ -41,8 +37,6 @@ module('Acceptance | managed-groups | read', 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' },
@@ -5,9 +5,7 @@
import { module, test } from 'qunit';
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 { visit, fillIn, click, currentURL } from '@ember/test-helpers';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
@@ -15,7 +13,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | onboarding', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const urls = {
@@ -24,10 +21,6 @@ module('Acceptance | onboarding', function (hooks) {
orgs: '/scopes/global/scopes',
};
hooks.beforeEach(async function () {
await authenticateSession({});
});
test('show targetAddress and targetPort fields', async function (assert) {
setRunOptions({
rules: {
@@ -6,22 +6,15 @@
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 { authenticateSession } from 'ember-simple-auth/test-support';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | onboarding | success', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
hooks.beforeEach(async function () {
await authenticateSession({});
});
const urls = {
onboarding: '/onboarding',
success: '/onboarding/success',
@@ -6,16 +6,13 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn, select } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
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 | policies | create', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
let features;
let getPolicyCount;
@@ -34,7 +31,7 @@ module('Acceptance | policies | create', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -45,7 +42,6 @@ module('Acceptance | policies | create', function (hooks) {
getPolicyCount = () => this.server.schema.policies.all().models.length;
features = this.owner.lookup('service:features');
features.enable('ssh-session-recording');
await authenticateSession({ username: 'admin' });
});
test('users can create a new policy with global scope', async function (assert) {
@@ -6,15 +6,12 @@
import { module, test } from 'qunit';
import { visit, 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 | policies | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let featuresService;
@@ -35,8 +32,7 @@ module('Acceptance | policies | delete', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -6,15 +6,12 @@
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 { 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 | policies | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let featuresService;
@@ -35,7 +32,7 @@ module('Acceptance | policies | list', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -45,7 +42,6 @@ module('Acceptance | policies | list', function (hooks) {
intl = this.owner.lookup('service:intl');
await authenticateSession({});
featuresService = this.owner.lookup('service:features');
});
@@ -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 | policies | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let features;
@@ -35,7 +32,7 @@ module('Acceptance | policies | read', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -50,7 +47,6 @@ module('Acceptance | policies | read', function (hooks) {
features = this.owner.lookup('service:features');
features.enable('ssh-session-recording');
await authenticateSession({ username: 'admin' });
});
test('visiting a policy', async function (assert) {
@@ -6,15 +6,12 @@
import { module, test } from 'qunit';
import { visit, click, fillIn, select } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
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 | policies | update', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
let features;
@@ -33,7 +30,7 @@ module('Acceptance | policies | update', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.policy = this.server.create('policy', {
scope: instances.scopes.global,
@@ -45,7 +42,6 @@ module('Acceptance | policies | update', function (hooks) {
features = this.owner.lookup('service:features');
features.enable('ssh-session-recording');
await authenticateSession({});
});
test('users can update forever select option to a custom input', async function (assert) {
@@ -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 selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | roles | create', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let getRolesCount;
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -35,7 +31,6 @@ module('Acceptance | roles | create', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({ username: 'admin' });
instances.scopes.org = this.server.create(
'scope',
{
@@ -6,22 +6,18 @@
import { module, test } from 'qunit';
import { visit, 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 * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | roles | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -34,8 +30,6 @@ module('Acceptance | roles | delete', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -14,9 +14,7 @@ import {
waitFor,
} 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 {
GRANT_SCOPE_THIS,
GRANT_SCOPE_CHILDREN,
@@ -29,7 +27,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | roles | global-scope', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let confirmService;
@@ -52,10 +49,9 @@ module('Acceptance | roles | global-scope', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({ username: 'admin' });
confirmService = this.owner.lookup('service:confirm');
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -6,15 +6,12 @@
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 { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
module('Acceptance | roles | grants', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
// This is unique to permissions tests and only used once here
const FIELD_GRANT_DISABLED = 'input[disabled]';
@@ -23,7 +20,6 @@ module('Acceptance | roles | grants', function (hooks) {
const instances = {
scopes: {
global: null,
org: null,
},
role: null,
@@ -35,8 +31,6 @@ module('Acceptance | roles | grants', 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' },
@@ -14,9 +14,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 { GRANT_SCOPE_THIS } from 'api/models/role';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
@@ -25,12 +23,10 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | roles | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
},
role1: null,
@@ -46,7 +42,6 @@ module('Acceptance | roles | 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' },
@@ -62,7 +57,6 @@ module('Acceptance | roles | list', function (hooks) {
urls.roles = `/scopes/${instances.scopes.org.id}/roles`;
urls.role1 = `${urls.roles}/${instances.role1.id}`;
urls.role2 = `${urls.roles}/${instances.role2.id}`;
await authenticateSession({});
});
test('users can navigate to roles with proper authorization', async function (assert) {
@@ -13,9 +13,7 @@ import {
waitUntil,
} 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 selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import {
@@ -27,14 +25,12 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | roles | org-scope', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let confirmService;
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -50,10 +46,8 @@ module('Acceptance | roles | org-scope', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({ username: 'admin' });
confirmService = this.owner.lookup('service:confirm');
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -6,22 +6,18 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, findAll } 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 selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | roles | principals', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
},
role: null,
@@ -35,8 +31,6 @@ module('Acceptance | roles | principals', function (hooks) {
let principalsCount;
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' },
@@ -6,9 +6,7 @@
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 { GRANT_SCOPE_THIS } from 'api/models/role';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
@@ -16,12 +14,10 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | roles | project-scope', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -34,8 +30,6 @@ module('Acceptance | roles | project-scope', 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' },
@@ -6,19 +6,15 @@
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';
module('Acceptance | roles | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -32,8 +28,6 @@ module('Acceptance | roles | read', 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' },
@@ -6,20 +6,16 @@
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';
module('Acceptance | roles | update', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -32,8 +28,6 @@ module('Acceptance | roles | update', function (hooks) {
};
hooks.beforeEach(async function () {
await authenticateSession({});
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
-6
View File
@@ -6,23 +6,19 @@
import { module, test } from 'qunit';
import { click, currentURL, fillIn, visit } 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 | scopes', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let getScopeCount;
const instances = {
scopes: {
global: null,
org: null,
org2: null,
project: null,
@@ -47,7 +43,6 @@ module('Acceptance | scopes', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -80,7 +75,6 @@ module('Acceptance | scopes', function (hooks) {
urls.project2Targets = `${urls.project2Scope}/targets`;
// Generate resource counter
getScopeCount = (type) => this.server.schema.scopes.where({ type }).length;
await authenticateSession({ isGlobal: true, username: 'admin' });
});
test('visiting global scope', async function (assert) {
@@ -6,16 +6,13 @@
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 { authenticateSession } from 'ember-simple-auth/test-support';
import select from '@ember/test-helpers/dom/select';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | scope | add storage policy', function (hooks) {
module('Acceptance | scopes | add storage policy', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
let featuresService;
let policyOne;
@@ -24,7 +21,6 @@ module('Acceptance | scope | add storage policy', function (hooks) {
// Instances
const instances = {
scopes: {
global: null,
org: null,
},
sessionRecording: null,
@@ -44,7 +40,6 @@ module('Acceptance | scope | add storage policy', function (hooks) {
hooks.beforeEach(async function () {
featuresService = this.owner.lookup('service:features');
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -65,7 +60,6 @@ module('Acceptance | scope | add storage policy', function (hooks) {
urls.policy = `${urls.policies}/${policyOne.id}`;
urls.addStoragePolicy = `${urls.orgScope}/add-storage-policy`;
urls.newPolicy = `${urls.addStoragePolicy}/create`;
await authenticateSession({ username: 'admin' });
});
test('cannot attach policy on a scope without proper authorization', 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 | scopes | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let getScopeCount;
@@ -24,7 +21,6 @@ module('Acceptance | scopes | delete', function (hooks) {
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -39,7 +35,6 @@ module('Acceptance | scopes | delete', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -56,7 +51,6 @@ module('Acceptance | scopes | delete', function (hooks) {
// Generate resource counter
getScopeCount = (type) => this.server.schema.scopes.where({ type }).length;
confirmService = this.owner.lookup('service:confirm');
await authenticateSession({ isGlobal: true });
});
test('can delete scope', async function (assert) {
@@ -6,21 +6,17 @@
import { module, test } from 'qunit';
import { currentURL, visit, fillIn, waitFor, 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 * as selectors from './selectors';
import { faker } from '@faker-js/faker';
module('Acceptance | scopes | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const instances = {
scopes: {
global: null,
org1: null,
org2: null,
project1: null,
@@ -35,7 +31,6 @@ module('Acceptance | scopes | list', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org1 = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -56,7 +51,6 @@ module('Acceptance | scopes | list', function (hooks) {
urls.scopes = '/scopes';
urls.globalScope = '/scopes/global/scopes';
urls.orgScope = `/scopes/${instances.scopes.org1.id}/scopes`;
await authenticateSession({});
});
test('user gets redirected to scopes list view', async function (assert) {
@@ -6,16 +6,13 @@
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 * as selectors from './selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | scopes | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let features;
@@ -23,7 +20,6 @@ module('Acceptance | scopes | read', function (hooks) {
const instances = {
scopes: {
global: null,
org: null,
},
};
@@ -36,7 +32,6 @@ module('Acceptance | scopes | read', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -48,7 +43,6 @@ module('Acceptance | scopes | read', function (hooks) {
urls.orgScopeEdit = `/scopes/${instances.scopes.org.id}/edit`;
features = this.owner.lookup('service:features');
featureEdition = this.owner.lookup('service:featureEdition');
await authenticateSession({ isGlobal: true, username: 'admin' });
});
test('visiting org scope edit', async function (assert) {
@@ -6,22 +6,18 @@
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';
module('Acceptance | scopes | update', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let confirmService;
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -35,7 +31,6 @@ module('Acceptance | scopes | update', function (hooks) {
hooks.beforeEach(async function () {
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -54,8 +49,6 @@ module('Acceptance | scopes | update', function (hooks) {
urls.orgScopeEdit = `/scopes/${instances.scopes.org.id}/edit`;
urls.projectScope = `/scopes/${instances.scopes.project.id}`;
confirmService = this.owner.lookup('service:confirm');
await authenticateSession({ isGlobal: true });
});
test('can save changes to existing scope', async function (assert) {
@@ -6,10 +6,8 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn, waitFor } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIntl } from 'ember-intl/test-support';
import { setupSqlite } from 'api/test-support/helpers/sqlite';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { faker } from '@faker-js/faker';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import * as selectors from './selectors';
@@ -20,9 +18,8 @@ import {
} from 'api/models/session-recording';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | session recordings | list', function (hooks) {
module('Acceptance | session-recordings | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
setupIntl(hooks, 'en-us');
@@ -62,7 +59,7 @@ module('Acceptance | session recordings | list', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -122,8 +119,6 @@ module('Acceptance | session recordings | list', function (hooks) {
featuresService = this.owner.lookup('service:features');
featuresService.enable('ssh-session-recording');
await authenticateSession({});
});
test('users can navigate to session-recordings with proper authorization', async function (assert) {
@@ -6,8 +6,6 @@
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 { authenticateSession } from 'ember-simple-auth/test-support';
import { setupIntl } from 'ember-intl/test-support';
import { setupSqlite } from 'api/test-support/helpers/sqlite';
import * as commonSelectors from 'admin/tests/helpers/selectors';
@@ -16,7 +14,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | session-recordings | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
setupIntl(hooks, 'en-us');
@@ -41,7 +38,7 @@ module('Acceptance | session-recordings | read', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -67,7 +64,6 @@ module('Acceptance | session-recordings | read', function (hooks) {
urls.sessionRecordings = `${urls.globalScope}/session-recordings`;
urls.sessionRecording = `${urls.sessionRecordings}/${instances.sessionRecording.id}/channels-by-connection`;
urls.channelRecording = `${urls.sessionRecording}/${instances.channelRecording.id}`;
await authenticateSession({ username: 'admin' });
featuresService = this.owner.lookup('service:features');
});
@@ -6,8 +6,6 @@
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 { authenticateSession } from 'ember-simple-auth/test-support';
import { Response } from 'miragejs';
import { setupSqlite } from 'api/test-support/helpers/sqlite';
import { setupIntl } from 'ember-intl/test-support';
@@ -19,7 +17,6 @@ module(
'Acceptance | session-recordings | session-recording | channels-by-connection | channel',
function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
setupIntl(hooks, 'en-us');
@@ -48,7 +45,7 @@ module(
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -81,7 +78,6 @@ module(
this.server.schema.sessionRecordings.all().models.length;
featuresService = this.owner.lookup('service:features');
await authenticateSession({});
});
test('user can navigate to a channel', async function (assert) {
@@ -6,10 +6,8 @@
import { module, test } from 'qunit';
import { click, currentURL, fillIn, visit, waitFor } 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 { faker } from '@faker-js/faker';
import { TYPE_TARGET_SSH, TYPE_TARGET_TCP } from 'api/models/target';
import {
@@ -24,7 +22,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | sessions | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
const CREATED_TIME_VALUES_ARRAY = [
@@ -63,7 +60,7 @@ module('Acceptance | sessions | list', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.admin = this.server.create('user', {
scopeId: 'global',
name: 'admin',
@@ -108,8 +105,6 @@ module('Acceptance | sessions | list', function (hooks) {
urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`;
urls.projectScope = `/scopes/${instances.scopes.project.id}`;
urls.sessions = `${urls.projectScope}/sessions`;
await authenticateSession({ username: 'admin' });
});
test('visiting sessions', async function (assert) {
@@ -6,17 +6,14 @@
import { module, test } from 'qunit';
import { visit, currentURL, click, fillIn, select } 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 selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | storage-buckets | create', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let features;
@@ -36,7 +33,7 @@ module('Acceptance | storage-buckets | create', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -49,7 +46,6 @@ module('Acceptance | storage-buckets | create', function (hooks) {
features = this.owner.lookup('service:features');
features.enable('ssh-session-recording');
await authenticateSession({ username: 'admin' });
});
test('users can create a new storage bucket aws plugin type with global scope', async function (assert) {
@@ -5,16 +5,13 @@
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 { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { setupSqlite } from 'api/test-support/helpers/sqlite';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | storage-buckets | delete', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let intl;
@@ -39,7 +36,7 @@ module('Acceptance | storage-buckets | delete', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -52,7 +49,6 @@ module('Acceptance | storage-buckets | delete', function (hooks) {
getStorageBucketCount = () =>
this.server.schema.storageBuckets.all().models.length;
await authenticateSession({});
intl = this.owner.lookup('service:intl');
features = this.owner.lookup('service:features');
features.enable('ssh-session-recording');
@@ -6,16 +6,13 @@
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 { authenticateSession } from 'ember-simple-auth/test-support';
import * as selectors from './selectors';
import * as commonSelectors from 'admin/tests/helpers/selectors';
import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | storage-buckets | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let featuresService;
@@ -36,7 +33,7 @@ module('Acceptance | storage-buckets | list', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -46,7 +43,6 @@ module('Acceptance | storage-buckets | list', function (hooks) {
intl = this.owner.lookup('service:intl');
await authenticateSession({});
featuresService = this.owner.lookup('service:features');
});
@@ -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 | storage-buckets | read', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let features;
@@ -35,7 +32,7 @@ module('Acceptance | storage-buckets | read', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -50,7 +47,6 @@ module('Acceptance | storage-buckets | read', function (hooks) {
features = this.owner.lookup('service:features');
features.enable('ssh-session-recording');
await authenticateSession({ username: 'admin' });
});
test('visiting a storage bucket', async function (assert) {
@@ -6,7 +6,6 @@
import { module, test } from 'qunit';
import { visit, 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 * as selectors from './selectors';
@@ -15,7 +14,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | storage-buckets | update', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let features;
@@ -35,7 +33,7 @@ module('Acceptance | storage-buckets | update', function (hooks) {
};
hooks.beforeEach(async function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.storageBucket = this.server.create('storage-bucket', {
scope: instances.scopes.global,
});
@@ -6,10 +6,8 @@
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';
@@ -27,7 +25,6 @@ import { TYPE_TARGET_RDP, TYPE_TARGET_TCP } from 'api/models/target';
module('Acceptance | targets | brokered credential sources', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
let getCredentialLibraryCount;
@@ -39,7 +36,6 @@ module('Acceptance | targets | brokered credential sources', function (hooks) {
const instances = {
scopes: {
global: null,
org: null,
project: null,
},
@@ -70,7 +66,6 @@ module('Acceptance | targets | brokered credential sources', function (hooks) {
hooks.beforeEach(async function () {
featuresService = this.owner.lookup('service:features');
// Generate resources
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -146,8 +141,6 @@ module('Acceptance | targets | brokered credential sources', function (hooks) {
getCredentialCount = () =>
this.server.schema.credentials.all().models.length;
credentialSourceCount = getCredentialLibraryCount() + getCredentialCount();
await authenticateSession({ username: 'admin' });
});
test.each(
@@ -6,9 +6,7 @@
import { module, test } from 'qunit';
import { click, fillIn, getContext, visit } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import { setupSqlite } from 'api/test-support/helpers/sqlite';
import { setupIntl } from 'ember-intl/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';
@@ -18,7 +16,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
module('Acceptance | targets | create-alias', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
setupSqlite(hooks);
setupIntl(hooks, 'en-us');
@@ -46,7 +43,7 @@ module('Acceptance | targets | create-alias', function (hooks) {
hooks.beforeEach(async function () {
const { owner } = getContext();
featuresService = owner.lookup('service:features');
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.global = this.server.schema.scopes.find('global');
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
@@ -69,8 +66,6 @@ module('Acceptance | targets | create-alias', function (hooks) {
urls.target = `${urls.targets}/${instances.target.id}`;
getAliasCount = () => this.server.schema.aliases.all().models.length;
await authenticateSession({ username: 'admin' });
});
test('users can create a new alias for a target of TCP type', async function (assert) {
Loaded 100 of 195 files, more files were not shown because too many files have changed in this diff. Show more