* feat: 🎸 Revised auth-method model Revised auth-method model to include LDAP attributes ✅ Closes: ICU-10024 * chore: 🤖 create transform for `account_attribute_maps` Create transform to handle `account_attribute_maps` array * refactor: 💡 Refactor transform and serializer Refactor `account_claims_map` transforms overall name and logic to be used for `account_attributes_map`. Also refactored serializer to serialize auth-method data, by type. ✅ Closes: ICU-100024 * refactor: 💡 refactor transform Refactor `account_claim_maps` transform. * Update addons/api/addon/serializers/auth-method.js changing naming of serialize method Co-authored-by: Dharini Jeeva <dharini@hashicorp.com> * refactor: 💡 refactor serializer Refactor naming convention for serializer methods and added comments for attributes. * refactor: 💡 quick refactor fixed name for method call in serializer * refactor: 💡 refactor attributes and serializer Refactor attributes for `auth-methods` to use the `for` option to select which attribute belongs to which auth-method. * Update auth-method.js comment change * refactor: 💡 rebase rebase * Update addons/api/addon/serializers/auth-method.js Co-authored-by: Dharini Jeeva <dharini@hashicorp.com> * Update addons/api/addon/serializers/auth-method.js Co-authored-by: Dharini Jeeva <dharini@hashicorp.com> * Update addons/api/addon/serializers/auth-method.js Co-authored-by: Dharini Jeeva <dharini@hashicorp.com> * Update addons/api/addon/serializers/auth-method.js Co-authored-by: Dharini Jeeva <dharini@hashicorp.com> * Update addons/api/addon/serializers/auth-method.js Co-authored-by: Dharini Jeeva <dharini@hashicorp.com> * refactor: 💡 refactor serialize attribute method refactor serialize attribute method not not include type for password, and instead let `serializePassword` handle serialization * refactor: 💡 refactor serializer Refcator serializer to not include password type in attribute serializer and added `for` to one missing attribute. * Update addons/api/addon/serializers/auth-method.js Co-authored-by: Dharini Jeeva <dharini@hashicorp.com> --------- Co-authored-by: Dharini Jeeva <dharini@hashicorp.com>
32 lines
1004 B
JavaScript
32 lines
1004 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
import { module, test } from 'qunit';
|
|
import { setupTest } from 'ember-qunit';
|
|
|
|
module('Unit | Transform | account value map array', function (hooks) {
|
|
setupTest(hooks);
|
|
|
|
test('it deserializes an array of account claims', function (assert) {
|
|
assert.expect(1);
|
|
const transform = this.owner.lookup('transform:account-value-map-array');
|
|
const deserialized = transform.deserialize(['oid=sub', 'full_name=name']);
|
|
assert.deepEqual(deserialized, [
|
|
{ from: 'oid', to: 'sub' },
|
|
{ from: 'full_name', to: 'name' },
|
|
]);
|
|
});
|
|
|
|
test('it serializes an array of account claims', function (assert) {
|
|
assert.expect(1);
|
|
const transform = this.owner.lookup('transform:account-value-map-array');
|
|
const serialized = transform.serialize([
|
|
{ from: 'oid', to: 'sub' },
|
|
{ from: 'full_name', to: 'name' },
|
|
]);
|
|
assert.deepEqual(serialized, ['oid=sub', 'full_name=name']);
|
|
});
|
|
});
|