Refactor credential sources to brokered credential sources (#1264)

* chore: 🤖 refactor credential sources to brokered credential source
This commit is contained in:
Dharini Jeeva authored and GitHub committed 2022-08-18 09:11:38 -07:00
1 parent f4f7c0e343
commit 9a8665a314
21 files changed
+136 -110

No files matched your search

+2 -2
View File
@@ -30,14 +30,14 @@ export default class TargetAbility extends ModelAbility {
/**
* @type {boolean}
*/
get canAddCredentialSources() {
get canAddBrokeredCredentialSources() {
return this.hasAuthorizedAction('add-credential-sources');
}
/**
* @type {boolean}
*/
get canRemoveCredentialSources() {
get canRemoveBrokeredCredentialSources() {
return this.hasAuthorizedAction('remove-credential-sources');
}
}
+9 -6
View File
@@ -23,7 +23,7 @@ export default class TargetModel extends GeneratedTargetModel {
/**
* Credential source ids are read only and can be
* persisted via a dedicated call to `addCredentialSources()`.
* persisted via a dedicated call to `addBrokeredCredentialSources()`.
*/
@fragmentArray('fragment-string', {
readOnly: true,
@@ -54,7 +54,7 @@ export default class TargetModel extends GeneratedTargetModel {
* @type {[CredentialLibraryModel, CredentialModel]}
*/
@computed('brokered_credential_source_ids.[]', 'store')
get credentialSources() {
get brokeredCredentialSources() {
return this.brokered_credential_source_ids
.map((source) => {
if (source.value.startsWith('cred')) {
@@ -161,7 +161,10 @@ export default class TargetModel extends GeneratedTargetModel {
* @param {object} options.adapterOptions
* @return {Promise}
*/
addCredentialSources(credentialSourceIDs, options = { adapterOptions: {} }) {
addBrokeredCredentialSources(
credentialSourceIDs,
options = { adapterOptions: {} }
) {
const defaultAdapterOptions = {
method: 'add-credential-sources',
credentialSourceIDs,
@@ -184,7 +187,7 @@ export default class TargetModel extends GeneratedTargetModel {
* @param {object} options.adapterOptions
* @return {Promise}
*/
removeCredentialSources(
removeBrokeredCredentialSources(
credentialSourceIDs,
options = { adapterOptions: {} }
) {
@@ -208,8 +211,8 @@ export default class TargetModel extends GeneratedTargetModel {
* @param {object} options
* @return {Promise}
*/
removeCredentialSource(credentialSourceID, options) {
return this.removeCredentialSources([credentialSourceID], options);
removeBrokeredCredentialSource(credentialSourceID, options) {
return this.removeBrokeredCredentialSources([credentialSourceID], options);
}
/**
+2 -2
View File
@@ -461,7 +461,7 @@ export default function () {
return !attrs.hostSourceIds.includes(id);
});
}
// If adding credential sources, push them into the array
// If adding brokered credential sources, push them into the array
if (method === 'add-credential-sources') {
updatedAttrs.credentialLibraryIds = target.credentialLibraryIds;
updatedAttrs.credentialIds = target.credentialIds;
@@ -478,7 +478,7 @@ export default function () {
}
});
}
// If deleting credential sources, filter them out of the array
// If deleting brokered credential sources, filter them out of the array
if (method === 'remove-credential-sources') {
updatedAttrs.credentialLibraryIds = target.credentialLibraryIds;
updatedAttrs.credentialIds = target.credentialIds;
@@ -43,9 +43,9 @@ module('Unit | Abilities | Target', function (hooks) {
const model = {
authorized_actions: ['add-credential-sources'],
};
assert.ok(service.can('addCredentialSources target', model));
assert.ok(service.can('addBrokeredCredentialSources target', model));
model.authorized_actions = [];
assert.notOk(service.can('addCredentialSources target', model));
assert.notOk(service.can('addBrokeredCredentialSources target', model));
});
test('it reflects when a given target may remove crednetial sources', function (assert) {
@@ -54,8 +54,8 @@ module('Unit | Abilities | Target', function (hooks) {
const model = {
authorized_actions: ['remove-credential-sources'],
};
assert.ok(service.can('removeCredentialSources target', model));
assert.ok(service.can('removeBrokeredCredentialSources target', model));
model.authorized_actions = [];
assert.notOk(service.can('removeCredentialSources target', model));
assert.notOk(service.can('removeBrokeredCredentialSources target', model));
});
});
+9 -9
View File
@@ -231,7 +231,7 @@ module('Unit | Model | target', function (hooks) {
);
});
test('it has a `credentialSources` array of resolved model instances (if those instances are already in the store)', function (assert) {
test('it has a `brokeredCredentialSources` array of resolved model instances (if those instances are already in the store)', function (assert) {
assert.expect(4);
const store = this.owner.lookup('service:store');
store.push({
@@ -250,7 +250,7 @@ module('Unit | Model | target', function (hooks) {
'Target has two entires in brokered_credential_source_ids'
);
assert.strictEqual(
target.credentialSources.length,
target.brokeredCredentialSources.length,
0,
'Target has no resolved credentialSources because they are not loaded yet'
);
@@ -281,13 +281,13 @@ module('Unit | Model | target', function (hooks) {
'Target has two entires in brokered_credential_source_ids'
);
assert.strictEqual(
target.credentialSources.length,
target.brokeredCredentialSources.length,
2,
'Target has two resolved credentialSources'
);
});
test('it has an `addCredentialSources` method that targets a specific POST API endpoint and serialization', async function (assert) {
test('it has an `addBrokeredCredentialSources` method that targets a specific POST API endpoint and serialization', async function (assert) {
assert.expect(1);
this.server.post(
'/v1/targets/123abc:add-credential-sources',
@@ -318,10 +318,10 @@ module('Unit | Model | target', function (hooks) {
},
});
const model = store.peekRecord('target', '123abc');
await model.addCredentialSources(['123_abc', 'foobar']);
await model.addBrokeredCredentialSources(['123_abc', 'foobar']);
});
test('it has a `removeCredentialSources` method that targets a specific POST API endpoint and serialization', async function (assert) {
test('it has a `removeBrokeredCredentialSources` method that targets a specific POST API endpoint and serialization', async function (assert) {
assert.expect(1);
this.server.post(
'/v1/targets/123abc:remove-credential-sources',
@@ -352,10 +352,10 @@ module('Unit | Model | target', function (hooks) {
},
});
const model = store.peekRecord('target', '123abc');
await model.removeCredentialSources(['1', '2']);
await model.removeBrokeredCredentialSources(['1', '2']);
});
test('it has a `removeCredentialSource` method that deletes a single credential library using `removeCredentialSources` method', async function (assert) {
test('it has a `removeBrokeredCredentialSource` method that deletes a single credential library using `removeBrokeredCredentialSources` method', async function (assert) {
assert.expect(1);
this.server.post(
'/v1/targets/123abc:remove-credential-sources',
@@ -386,7 +386,7 @@ module('Unit | Model | target', function (hooks) {
},
});
const model = store.peekRecord('target', '123abc');
await model.removeCredentialSource('2');
await model.removeBrokeredCredentialSource('2');
});
test('it has isSSH property and returns the expected values', function (assert) {
+10 -10
View File
@@ -274,7 +274,7 @@ target:
create: New Target
delete: Delete Target
add-host-sources: Add Host Sources
add-credential-sources: Add Credential Sources
add-brokered-credential-sources: Add Brokered Credentials
types:
tcp: TCP
ssh: SSH
@@ -294,22 +294,22 @@ target:
add:
title: Add Host Sources
description: Select host sources to assign to this target.
credential-source:
title: Credential Source
title_plural: Credential Sources
brokered-credential-source:
title: Brokered Credential
title_plural: Brokered Credentials
types:
vault: Vault
username_password: Username & Password
messages:
welcome:
title: Welcome to Credential Sources
description: No credential sources in this target.
title: Welcome to brokered credentials
description: No brokered credential sources in this target.
none:
title: No Credential Sources Available
description: No credential sources available to add to this target.
title: No Brokered Credential Sources Available
description: No brokered credential sources available to add to this target.
add:
title: Add Credential Sources
description: Select credential sources to assign to this target.
title: Add Brokered Credential Sources
description: Select brokered credential sources to assign to this target.
credential-store:
title: Credential Store
title_plural: Credential Stores
@@ -7,7 +7,7 @@
as |form|
>
<form.actions
@submitText={{t 'resources.target.actions.add-credential-sources'}}
@submitText={{t 'resources.target.actions.add-brokered-credential-sources'}}
@cancelText={{t 'actions.cancel'}}
/>
@@ -33,7 +33,7 @@
<row.cell>
<Rose::Badge>{{t
(concat
'resources.target.credential-source.types.'
'resources.target.brokered-credential-source.types.'
credentialSource.type
)
}}</Rose::Badge>
@@ -2,7 +2,7 @@ import Component from '@glimmer/component';
import { action } from '@ember/object';
import { A } from '@ember/array';
export default class FormTargetAddCredentialSourcesIndexComponent extends Component {
export default class FormTargetAddBrokeredCredentialSourcesIndexComponent extends Component {
// =properties
/**
@@ -8,9 +8,11 @@
{{t 'resources.target.actions.add-host-sources'}}
</dropdown.link>
{{/if}}
{{#if (can 'addCredentialSources target' @model)}}
<dropdown.link @route='scopes.scope.targets.target.add-credential-sources'>
{{t 'resources.target.actions.add-credential-sources'}}
{{#if (can 'addBrokeredCredentialSources target' @model)}}
<dropdown.link
@route='scopes.scope.targets.target.add-brokered-credential-sources'
>
{{t 'resources.target.actions.add-brokered-credential-sources'}}
</dropdown.link>
{{/if}}
{{#if (can 'delete model' @model)}}
@@ -5,7 +5,7 @@
<nav.link @route='scopes.scope.targets.target.host-sources'>
{{t 'resources.target.host-source.title_plural'}}
</nav.link>
<nav.link @route='scopes.scope.targets.target.credential-sources'>
{{t 'resources.target.credential-source.title_plural'}}
<nav.link @route='scopes.scope.targets.target.brokered-credential-sources'>
{{t 'resources.target.brokered-credential-source.title_plural'}}
</nav.link>
</Rose::Nav::Tabs>
@@ -2,7 +2,7 @@ import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { computed } from '@ember/object';
export default class ScopesScopeTargetsTargetAddCredentialSourcesController extends Controller {
export default class ScopesScopeTargetsTargetAddBrokeredCredentialSourcesController extends Controller {
// =services
@service intl;
@@ -13,7 +13,7 @@ export default class ScopesScopeTargetsTargetAddCredentialSourcesController exte
* Checks for unassigned credential sources.
* @type {boolean}
*/
get hasAvailableCredentialSources() {
get hasAvailableBrokeredCredentialSources() {
return this.filteredCredentialSources.length > 0;
}
@@ -44,6 +44,8 @@ export default class ScopesScopeTargetsTargetAddCredentialSourcesController exte
* @type {string}
*/
get breadCrumb() {
return this.intl.t('resources.target.actions.add-credential-sources');
return this.intl.t(
'resources.target.actions.add-brokered-credential-sources'
);
}
}
@@ -13,6 +13,8 @@ export default class ScopesScopeTargetsTargetCredentialSourcesController extends
* @type {string}
*/
get breadCrumb() {
return this.intl.t('resources.target.credential-source.title_plural');
return this.intl.t(
'resources.target.brokered-credential-source.title_plural'
);
}
}
+2 -2
View File
@@ -75,8 +75,8 @@ Router.map(function () {
this.route('target', { path: ':target_id' }, function () {
this.route('host-sources', function () {});
this.route('add-host-sources');
this.route('credential-sources');
this.route('add-credential-sources');
this.route('brokered-credential-sources');
this.route('add-brokered-credential-sources');
});
this.route('new');
});
@@ -5,7 +5,7 @@ import { action } from '@ember/object';
import { loading } from 'ember-loading';
import { notifySuccess, notifyError } from 'core/decorators/notify';
export default class ScopesScopeTargetsTargetAddCredentialSourcesRoute extends Route {
export default class ScopesScopeTargetsTargetAddBrokeredCredentialSourcesRoute extends Route {
// =services
@service intl;
@@ -67,8 +67,10 @@ export default class ScopesScopeTargetsTargetAddCredentialSourcesRoute extends R
@notifyError(({ message }) => message, { catch: true })
@notifySuccess('notifications.add-success')
async save(target, credentialLibraryIDs) {
await target.addCredentialSources(credentialLibraryIDs);
this.router.replaceWith('scopes.scope.targets.target.credential-sources');
await target.addBrokeredCredentialSources(credentialLibraryIDs);
this.router.replaceWith(
'scopes.scope.targets.target.brokered-credential-sources'
);
}
/**
@@ -76,6 +78,8 @@ export default class ScopesScopeTargetsTargetAddCredentialSourcesRoute extends R
*/
@action
cancel() {
this.router.replaceWith('scopes.scope.targets.target.credential-sources');
this.router.replaceWith(
'scopes.scope.targets.target.brokered-credential-sources'
);
}
}
@@ -5,7 +5,7 @@ import { loading } from 'ember-loading';
import { confirm } from 'core/decorators/confirm';
import { notifySuccess, notifyError } from 'core/decorators/notify';
export default class ScopesScopeTargetsTargetCredentialSourcesRoute extends Route {
export default class ScopesScopeTargetsTargetBrokeredCredentialSourcesRoute extends Route {
// =methods
/**
@@ -52,8 +52,8 @@ export default class ScopesScopeTargetsTargetCredentialSourcesRoute extends Rout
@confirm('questions.remove-confirm')
@notifyError(({ message }) => message, { catch: true })
@notifySuccess('notifications.remove-success')
async removeCredentialSource(target, credentialLibrary) {
await target.removeCredentialSource(credentialLibrary.id);
async removeBrokeredCredentialSource(target, credentialSource) {
await target.removeBrokeredCredentialSource(credentialSource.id);
this.refresh();
}
}
@@ -1,4 +1,4 @@
{{page-title (t 'resources.target.actions.add-credential-sources')}}
{{page-title (t 'resources.target.actions.add-brokered-credential-sources')}}
<Rose::Layout::Page as |page|>
@@ -8,14 +8,16 @@
<page.header>
<h2>
{{t 'resources.target.credential-source.messages.add.title'}}
{{t 'resources.target.brokered-credential-source.messages.add.title'}}
</h2>
<p>{{t 'resources.target.credential-source.messages.add.description'}}</p>
<p>{{t
'resources.target.brokered-credential-source.messages.add.description'
}}</p>
</page.header>
<page.body>
{{#if this.hasAvailableCredentialSources}}
<Form::Target::AddCredentialSources
{{#if this.hasAvailableBrokeredCredentialSources}}
<Form::Target::AddBrokeredCredentialSources
@model={{@model.target}}
@filteredCredentialSources={{this.filteredCredentialSources}}
@submit={{route-action 'save' @model.target}}
@@ -23,16 +25,22 @@
/>
{{/if}}
{{#unless this.hasAvailableCredentialSources}}
{{#unless this.hasAvailableBrokeredCredentialSources}}
<Rose::Layout::Centered>
<Rose::Message
@title={{t 'resources.target.credential-source.messages.none.title'}}
@title={{t
'resources.target.brokered-credential-source.messages.none.title'
}}
as |message|
>
<message.description>
{{t 'resources.target.credential-source.messages.none.description'}}
{{t
'resources.target.brokered-credential-source.messages.none.description'
}}
</message.description>
<message.link @route='scopes.scope.targets.target.credential-sources'>
<message.link
@route='scopes.scope.targets.target.brokered-credential-sources'
>
<Rose::Icon @name='flight-icons/svg/chevron-left-16' />
{{t 'actions.back'}}
</message.link>
@@ -1,4 +1,4 @@
{{page-title (t 'resources.target.credential-source.title_plural')}}
{{page-title (t 'resources.target.brokered-credential-source.title_plural')}}
<Rose::Layout::Page as |page|>
@@ -19,7 +19,7 @@
</page.actions>
<page.body>
{{#if @model.credentialSources}}
{{#if @model.brokeredCredentialSources}}
<Rose::Table as |table|>
<table.header as |header|>
@@ -31,52 +31,55 @@
</header.row>
</table.header>
<table.body as |body|>
{{#each @model.credentialSources as |credentialSource|}}
{{#each
@model.brokeredCredentialSources
as |brokeredCredentialSource|
}}
<body.row as |row|>
<row.headerCell>
{{#if (eq credentialSource.type 'username_password')}}
{{#if (eq brokeredCredentialSource.type 'username_password')}}
<LinkTo
@route='scopes.scope.credential-stores.credential-store.credentials.credential'
@models={{array
credentialSource.credential_store_id
credentialSource.id
brokeredCredentialSource.credential_store_id
brokeredCredentialSource.id
}}
>
{{credentialSource.displayName}}
{{brokeredCredentialSource.displayName}}
</LinkTo>
{{else}}
<LinkTo
@route='scopes.scope.credential-stores.credential-store.credential-libraries.credential-library'
@models={{array
credentialSource.credential_store_id
credentialSource.id
brokeredCredentialSource.credential_store_id
brokeredCredentialSource.id
}}
>
{{credentialSource.displayName}}
{{brokeredCredentialSource.displayName}}
</LinkTo>
{{/if}}
<p>{{credentialSource.description}}</p>
<p>{{brokeredCredentialSource.description}}</p>
</row.headerCell>
<row.cell>
<Rose::Badge>{{t
(concat
'resources.target.credential-source.types.'
credentialSource.type
'resources.target.brokered-credential-source.types.'
brokeredCredentialSource.type
)
}}</Rose::Badge>
</row.cell>
<row.cell>
<Copyable
@text={{credentialSource.id}}
@text={{brokeredCredentialSource.id}}
@buttonText={{t 'actions.copy-to-clipboard'}}
@acknowledgeText={{t 'states.copied'}}
>
<code>{{credentialSource.id}}</code>
<code>{{brokeredCredentialSource.id}}</code>
</Copyable>
</row.cell>
<row.cell>
{{#if (can 'removeCredentialSources target' @model)}}
{{#if (can 'removeBrokeredCredentialSources target' @model)}}
<Rose::Dropdown
@icon='flight-icons/svg/more-horizontal-16'
@iconOnly={{true}}
@@ -90,7 +93,9 @@
{{on
'click'
(route-action
'removeCredentialSource' @model credentialSource
'removeBrokeredCredentialSource'
@model
brokeredCredentialSource
)
}}
>
@@ -109,20 +114,20 @@
<Rose::Layout::Centered>
<Rose::Message
@title={{t
'resources.target.credential-source.messages.welcome.title'
'resources.target.brokered-credential-source.messages.welcome.title'
}}
as |message|
>
<message.description>
{{t
'resources.target.credential-source.messages.welcome.description'
'resources.target.brokered-credential-source.messages.welcome.description'
}}
</message.description>
<message.link
@route='scopes.scope.targets.target.add-credential-sources'
@route='scopes.scope.targets.target.add-brokered-credential-sources'
>
<Rose::Icon @name='flight-icons/svg/plus-circle-16' />
{{t 'resources.target.actions.add-credential-sources'}}
{{t 'resources.target.actions.add-brokered-credential-sources'}}
</message.link>
</Rose::Message>
</Rose::Layout::Centered>
@@ -40,7 +40,7 @@ module('Acceptance | targets | credential sources', function (hooks) {
target: null,
credentialLibraries: null,
credentialLibrary: null,
addCredentialSources: null,
addBrokeredCredentialSources: null,
};
hooks.beforeEach(function () {
@@ -86,10 +86,10 @@ module('Acceptance | targets | credential sources', function (hooks) {
urls.projectScope = `/scopes/${instances.scopes.project.id}`;
urls.targets = `${urls.projectScope}/targets`;
urls.target = `${urls.targets}/${instances.target.id}`;
urls.credentialSources = `${urls.target}/credential-sources`;
urls.credentialSources = `${urls.target}/brokered-credential-sources`;
urls.credentialLibrary = `${urls.projectScope}/credential-stores/${instances.credentialLibrary.credentialStoreId}/credential-libraries/${instances.credentialLibrary.id}`;
urls.credential = `${urls.projectScope}/credential-stores/${instances.credential.credentialStoreId}/credentials/${instances.credential.id}`;
urls.addCredentialSources = `${urls.target}/add-credential-sources`;
urls.addBrokeredCredentialSources = `${urls.target}/add-brokered-credential-sources`;
// Generate resource counter
getCredentialLibraryCount = () =>
this.server.schema.credentialLibraries.all().models.length;
@@ -129,15 +129,15 @@ module('Acceptance | targets | credential sources', function (hooks) {
test('visiting add credential sources', async function (assert) {
assert.expect(1);
await visit(urls.addCredentialSources);
await visit(urls.addBrokeredCredentialSources);
await a11yAudit();
assert.strictEqual(currentURL(), urls.addCredentialSources);
assert.strictEqual(currentURL(), urls.addBrokeredCredentialSources);
});
test('displays list of all credential source types available', async function (assert) {
assert.expect(2);
instances.target.update({ credentialLibraries: [] });
await visit(urls.addCredentialSources);
await visit(urls.addBrokeredCredentialSources);
assert.strictEqual(findAll('tbody tr').length, credentialSourceCount);
assert.notOk(find('.rose-message-title'));
});
@@ -146,14 +146,14 @@ module('Acceptance | targets | credential sources', function (hooks) {
assert.expect(2);
instances.target.update({ credentialLibraries: [] });
this.server.db.credentials.remove();
await visit(urls.addCredentialSources);
await visit(urls.addBrokeredCredentialSources);
assert.strictEqual(findAll('tbody tr').length, getCredentialLibraryCount());
assert.notOk(find('.rose-message-title'));
});
test('displays list of credential sources with only credentials available', async function (assert) {
assert.expect(2);
await visit(urls.addCredentialSources);
await visit(urls.addBrokeredCredentialSources);
assert.strictEqual(findAll('tbody tr').length, getCredentialCount());
assert.notOk(find('.rose-message-title'));
});
@@ -163,10 +163,10 @@ module('Acceptance | targets | credential sources', function (hooks) {
instances.target.update({ credentialLibraries: [] });
this.server.db.credentialLibraries.remove();
this.server.db.credentials.remove();
await visit(urls.addCredentialSources);
await visit(urls.addBrokeredCredentialSources);
assert.strictEqual(
find('.rose-message-title').textContent.trim(),
'No Credential Sources Available'
'No Brokered Credential Sources Available'
);
});
@@ -175,7 +175,7 @@ module('Acceptance | targets | credential sources', function (hooks) {
instances.target.update({ credentialLibraries: [] });
this.server.db.credentialLibraries.remove();
this.server.db.credentials.remove();
await visit(urls.addCredentialSources);
await visit(urls.addBrokeredCredentialSources);
await click(find('.rose-message-link'));
assert.strictEqual(currentURL(), urls.credentialSources);
});
@@ -185,7 +185,7 @@ module('Acceptance | targets | credential sources', function (hooks) {
instances.target.update({ credentialLibraries: [] });
await visit(urls.credentialSources);
assert.strictEqual(findAll('tbody tr').length, 0);
await visit(urls.addCredentialSources);
await visit(urls.addBrokeredCredentialSources);
assert.strictEqual(findAll('tbody tr').length, credentialSourceCount);
await click('tbody tr:first-child label');
await click('form [type="submit"]');
@@ -198,7 +198,7 @@ module('Acceptance | targets | credential sources', function (hooks) {
instances.target.update({ credentialLibraries: [] });
await visit(urls.credentialSources);
assert.strictEqual(findAll('tbody tr').length, 0);
await visit(urls.addCredentialSources);
await visit(urls.addBrokeredCredentialSources);
assert.strictEqual(findAll('tbody tr').length, credentialSourceCount);
await click('tbody tr:last-child label');
await click('form [type="submit"]');
@@ -211,7 +211,7 @@ module('Acceptance | targets | credential sources', function (hooks) {
instances.target.update({ credentialLibraries: [] });
await visit(urls.credentialSources);
assert.strictEqual(findAll('tbody tr').length, 0);
await visit(urls.addCredentialSources);
await visit(urls.addBrokeredCredentialSources);
assert.strictEqual(findAll('tbody tr').length, credentialSourceCount);
await click('tbody tr:last-child label');
await click('tbody tr:first-child label');
@@ -227,7 +227,7 @@ module('Acceptance | targets | credential sources', function (hooks) {
(item) => item !== 'add-credential-sources'
);
await visit(urls.credentialSources);
assert.notOk(find(`[href="${urls.addCredentialSources}"]`));
assert.notOk(find(`[href="${urls.addBrokeredCredentialSources}"]`));
});
test('can select and cancel credential sources to add', async function (assert) {
@@ -235,7 +235,7 @@ module('Acceptance | targets | credential sources', function (hooks) {
instances.target.update({ credentialLibraries: [] });
await visit(urls.credentialSources);
assert.strictEqual(findAll('tbody tr').length, 0);
await visit(urls.addCredentialSources);
await visit(urls.addBrokeredCredentialSources);
assert.strictEqual(findAll('tbody tr').length, credentialSourceCount);
await click('tbody label');
await click('form [type="button"]');
@@ -248,7 +248,7 @@ module('Acceptance | targets | credential sources', function (hooks) {
instances.target.update({ credentialLibraries: [] });
await visit(urls.credentialSources);
assert.strictEqual(findAll('tbody tr').length, 0);
await visit(urls.addCredentialSources);
await visit(urls.addBrokeredCredentialSources);
assert.strictEqual(findAll('tbody tr').length, credentialSourceCount);
await click('tbody tr:last-child label');
await click('tbody tr:first-child label');
@@ -272,7 +272,7 @@ module('Acceptance | targets | credential sources', function (hooks) {
);
});
instances.target.update({ credentialLibraries: [] });
await visit(urls.addCredentialSources);
await visit(urls.addBrokeredCredentialSources);
await click('tbody tr:last-child label');
await click('tbody tr:first-child label');
await click('form [type="submit"]');
@@ -287,7 +287,7 @@ module('Acceptance | targets | credential sources', function (hooks) {
assert.strictEqual(findAll('tbody tr').length, credentialLibraryCount);
await click('tbody tr .rose-dropdown-button-danger');
assert.strictEqual(findAll('tbody tr').length, credentialLibraryCount - 1);
await visit(urls.addCredentialSources);
await visit(urls.addBrokeredCredentialSources);
assert.strictEqual(findAll('tbody tr').length, credentialCount + 1);
});
@@ -303,7 +303,7 @@ module('Acceptance | targets | credential sources', function (hooks) {
assert.strictEqual(findAll('tbody tr').length, credentialCount);
await click('tbody tr .rose-dropdown-button-danger');
assert.strictEqual(findAll('tbody tr').length, credentialCount - 1);
await visit(urls.addCredentialSources);
await visit(urls.addBrokeredCredentialSources);
assert.strictEqual(findAll('tbody tr').length, credentialLibraryCount + 1);
});
@@ -2,14 +2,14 @@ import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module(
'Unit | Controller | scopes/scope/targets/target/credential-sources',
'Unit | Controller | scopes/scope/targets/target/brokered-credential-sources',
function (hooks) {
setupTest(hooks);
// TODO: Replace this with your real tests.
test('it exists', function (assert) {
let controller = this.owner.lookup(
'controller:scopes/scope/targets/target/credential-sources'
'controller:scopes/scope/targets/target/brokered-credential-sources'
);
assert.ok(controller);
});
@@ -2,13 +2,13 @@ import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module(
'Unit | Route | scopes/scope/targets/target/add-credential-sources',
'Unit | Route | scopes/scope/targets/target/add-brokered-credential-sources',
function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
let route = this.owner.lookup(
'route:scopes/scope/targets/target/add-credential-sources'
'route:scopes/scope/targets/target/add-brokered-credential-sources'
);
assert.ok(route);
});
@@ -2,13 +2,13 @@ import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module(
'Unit | Route | scopes/scope/targets/target/credential-sources',
'Unit | Route | scopes/scope/targets/target/brokered-credential-sources',
function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
let route = this.owner.lookup(
'route:scopes/scope/targets/target/credential-sources'
'route:scopes/scope/targets/target/brokered-credential-sources'
);
assert.ok(route);
});