fix: 🐛 accounts update refactor (#1822)

* fix: 🐛 accounts update refactor

Changed `type` and `auth_method_id` on `accounts` model to `readOnly` so
it is not sent in API payload.

✅ Closes: ICU-10503

* refactor: 💡 fix test

Refactor test to not include removed attributes.

* refactor: 💡 refactor test

Fix test
This commit is contained in:
Devon Anderson authored and GitHub committed 2023-08-04 07:46:58 -04:00
1 parent ed51b6b3a9
commit c425bb7686
3 files changed
+5 -14

No files matched your search

@@ -13,11 +13,13 @@ export default class GeneratedAccountModel extends BaseModel {
// =attributes
@attr('string', {
readOnly: true,
description: 'The type of the resource, to help differentiate schemas',
})
type;
@attr('string', {
readOnly: true,
description: 'The owning auth method ID.',
})
auth_method_id;
@@ -32,9 +32,7 @@ module('Unit | Serializer | account', function (hooks) {
const snapshot = record._createSnapshot();
const serializedRecord = serializer.serialize(snapshot);
assert.deepEqual(serializedRecord, {
type: TYPE_AUTH_METHOD_OIDC,
name: 'Name',
auth_method_id: '1',
description: 'Description',
version: 1,
attributes: {
@@ -70,9 +68,7 @@ module('Unit | Serializer | account', function (hooks) {
const serializedRecord = serializer.serialize(snapshot);
assert.notOk(serializedRecord.attributes);
assert.deepEqual(serializedRecord, {
type: TYPE_AUTH_METHOD_OIDC,
name: 'Name',
auth_method_id: '1',
description: 'Description',
version: 1,
});
@@ -93,9 +89,7 @@ module('Unit | Serializer | account', function (hooks) {
const snapshot = record._createSnapshot();
const serializedRecord = serializer.serialize(snapshot);
assert.deepEqual(serializedRecord, {
type: TYPE_AUTH_METHOD_PASSWORD,
name: 'Name',
auth_method_id: '1',
description: 'Description',
attributes: {
login_name: 'Login Name',
@@ -122,9 +116,7 @@ module('Unit | Serializer | account', function (hooks) {
};
const serializedRecord = serializer.serialize(snapshot);
assert.deepEqual(serializedRecord, {
type: TYPE_AUTH_METHOD_PASSWORD,
name: 'Name',
auth_method_id: '1',
description: 'Description',
attributes: {
login_name: 'Login Name',
@@ -207,9 +199,7 @@ module('Unit | Serializer | account', function (hooks) {
const snapshot = record._createSnapshot();
const serializedRecord = serializer.serialize(snapshot);
assert.deepEqual(serializedRecord, {
type: TYPE_AUTH_METHOD_LDAP,
name: 'Name',
auth_method_id: '1',
description: 'Description',
version: 1,
attributes: {
@@ -244,9 +234,8 @@ module('Unit | Serializer | account', function (hooks) {
const snapshot = record._createSnapshot();
const serializedRecord = serializer.serialize(snapshot);
assert.deepEqual(serializedRecord, {
type: TYPE_AUTH_METHOD_LDAP,
name: 'Name',
auth_method_id: '1',
description: 'Description',
version: 1,
});
@@ -46,10 +46,10 @@
@route='scopes.scope.auth-methods.auth-method.accounts.account'
@model={{B.data.id}}
>
{{B.data.accountName}}
{{B.data.displayName}}
</LinkTo>
{{else}}
{{B.data.accountName}}
{{B.data.displayName}}
{{/if}}
<p>{{B.data.description}}</p>
</B.Td>