feat: List accounts within a managed group

This commit is contained in:
Susmitha Girumala committed 2021-11-12 11:22:16 -05:00
1 parent ff5cc71f60
commit be5f033712
11 files changed
+207 -6

No files matched your search

@@ -123,7 +123,6 @@ module('Acceptance | auth methods | oidc', function (hooks) {
await visit(urls.authMethod);
await click('.rose-layout-page-actions .rose-dropdown-trigger');
await click(`.rose-dropdown[open] input[value="${newState}"]`);
// debugger;
const authMethod = this.server.db.authMethods.find(instances.authMethod.id);
assert.notEqual(
newState,
@@ -0,0 +1,69 @@
import { module, test } from 'qunit';
import { visit, currentURL, findAll } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import {
authenticateSession,
// These are left here intentionally for future reference.
//currentSession,
//invalidateSession,
} from 'ember-simple-auth/test-support';
module('Acceptance | managed-groups | accounts', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
const instances = {
scopes: {
global: null,
org: null,
},
authMethod: null,
managedGroup: null,
accounts: null,
};
const urls = {
orgScope: null,
authMethods: null,
managedGroups: null,
managedGroup: null,
managedGroupAccounts: null,
};
hooks.beforeEach(function () {
authenticateSession({});
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',
{
scope: instances.scopes.org,
type: 'oidc',
},
'withAccountsAndUsersAndManagedGroups'
);
instances.managedGroup = this.server.db.managedGroups[0];
// Generate route URLs for resources
urls.orgScope = `/scopes/${instances.scopes.org.id}`;
urls.authMethods = `${urls.orgScope}/auth-methods`;
urls.authMethod = `${urls.authMethods}/${instances.authMethod.id}`;
urls.managedGroups = `${urls.authMethod}/managed-groups`;
urls.managedGroup = `${urls.managedGroups}/${instances.managedGroup.id}`;
urls.managedGroupAccounts = `${urls.managedGroup}/accounts`;
});
test('User can navigate to index', async function (assert) {
assert.expect(3);
const accountsCount = instances.managedGroup.memberIds.length;
await visit(urls.managedGroupAccounts);
await a11yAudit();
assert.equal(currentURL(), urls.managedGroupAccounts);
assert.ok(accountsCount);
assert.equal(findAll('tbody tr').length, accountsCount);
});
});
@@ -0,0 +1,16 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module(
'Unit | Route | scopes/scope/auth-methods/auth-method/managed-groups/managed-group/accounts',
function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
let route = this.owner.lookup(
'route:scopes/scope/auth-methods/auth-method/managed-groups/managed-group/accounts'
);
assert.ok(route);
});
}
);