chore: 🤖 tweak oidc attributes serialization

This commit is contained in:
Randall Morey committed 2021-05-21 16:38:59 -04:00
1 parent 3d8a70d676
commit b19583c08d
8 files changed
+132 -54

No files matched your search

@@ -47,6 +47,13 @@ module('Unit | Serializer | auth method', function (hooks) {
{ value: 'certificate-1234' },
{ value: 'certificate-5678' },
],
api_url_prefix: 'protocol://host:port/foo',
client_id: 'id123',
client_secret: 'secret456',
disable_discovered_config_validation: true,
dry_run: true,
issuer: 'http://www.example.net',
max_age: 500,
},
});
@@ -62,15 +69,13 @@ module('Unit | Serializer | auth method', function (hooks) {
signing_algorithms: ['RS256', 'RS384'],
allowed_audiences: ['www.alice.com', 'www.alice.com/admin'],
idp_ca_certs: ['certificate-1234', 'certificate-5678'],
api_url_prefix: null,
callback_url: null,
client_id: null,
client_secret: null,
client_secret_hmac: null,
disable_discovered_config_validation: false,
dry_run: false,
issuer: null,
max_age: null,
api_url_prefix: 'protocol://host:port/foo',
client_id: 'id123',
client_secret: 'secret456',
disable_discovered_config_validation: true,
dry_run: true,
issuer: 'http://www.example.net',
max_age: 500,
},
});
});
@@ -0,0 +1,37 @@
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
module('Unit | Serializer | fragment auth method attributes', function (hooks) {
setupTest(hooks);
test('it serializes empty strings to null', function (assert) {
assert.expect(1);
const store = this.owner.lookup('service:store');
const record = store.createRecord('user', {
name: '',
description: '',
version: null,
});
let serializedRecord = record.serialize();
assert.deepEqual(serializedRecord, {
name: null,
description: null,
});
});
test('it does not serialize client_secret if present but falsy', function (assert) {
assert.expect(1);
const store = this.owner.lookup('service:store');
const record = store.createRecord('user', {
name: '',
description: '',
version: null,
client_secret: false,
});
let serializedRecord = record.serialize();
assert.deepEqual(serializedRecord, {
name: null,
description: null,
});
});
});