[PR #9644/250dc113 backport][stable-10] Fb keycloak client improvement (#9671)
Fb keycloak client improvement (#9644)
* Fix for failed test
TASK [keycloak_client : Assert changes not detected in last two tasks (desire when same, and check)] ***
task path: /root/ansible_collections/community/general/tests/output/.tmp/integration/keycloak_client-p3ttqf7d-ÅÑŚÌβŁÈ/tests/integration/targets/keycloak_client/tasks/main.yml:79
fatal: [testhost]: FAILED! => {
"assertion": "check_client_when_present_and_same is not changed",
"changed": false,
"evaluated_to": false,
"msg": "Assertion failed"
}
* Improved test data to test more scenarios, e.g documentation uses True in examples
* Normalize values in config
* add changelog
* Apply suggestions from code review
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
* Update tests/integration/targets/keycloak_client/vars/main.yml
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
* Update changelogs/fragments/9644-kc_client-test-improvement-and-fix.yaml
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
---------
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
(cherry picked from commit 250dc1139c
)
Co-authored-by: amPrimeSign <146177975+amPrimeSign@users.noreply.github.com>
pull/9673/head
parent
c35f13084d
commit
df496e37c0
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- keycloak_client - fix and improve existing tests. The module showed a diff without actual changes, solved by improving the ``normalise_cr()`` function (https://github.com/ansible-collections/community.general/pull/9644).
|
|
@ -758,9 +758,19 @@ def normalise_cr(clientrep, remove_ids=False):
|
||||||
if remove_ids:
|
if remove_ids:
|
||||||
mapper.pop('id', None)
|
mapper.pop('id', None)
|
||||||
|
|
||||||
|
# Convert bool to string
|
||||||
|
if 'config' in mapper:
|
||||||
|
for key, value in mapper['config'].items():
|
||||||
|
if isinstance(value, bool):
|
||||||
|
mapper['config'][key] = str(value).lower()
|
||||||
|
|
||||||
# Set to a default value.
|
# Set to a default value.
|
||||||
mapper['consentRequired'] = mapper.get('consentRequired', False)
|
mapper['consentRequired'] = mapper.get('consentRequired', False)
|
||||||
|
|
||||||
|
if 'attributes' in clientrep:
|
||||||
|
for key, value in clientrep['attributes'].items():
|
||||||
|
if isinstance(value, bool):
|
||||||
|
clientrep['attributes'][key] = str(value).lower()
|
||||||
return clientrep
|
return clientrep
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,9 @@ protocol_mappers1:
|
||||||
"claim.name": "email"
|
"claim.name": "email"
|
||||||
"user.attribute": "email"
|
"user.attribute": "email"
|
||||||
"jsonType.label": "String"
|
"jsonType.label": "String"
|
||||||
"id.token.claim": "true"
|
"id.token.claim": true
|
||||||
"access.token.claim": "true"
|
"access.token.claim": true
|
||||||
"userinfo.token.claim": "true"
|
"userinfo.token.claim": true
|
||||||
|
|
||||||
- name: 'email_verified'
|
- name: 'email_verified'
|
||||||
protocol: 'openid-connect'
|
protocol: 'openid-connect'
|
||||||
|
@ -45,9 +45,9 @@ protocol_mappers1:
|
||||||
"claim.name": "email_verified"
|
"claim.name": "email_verified"
|
||||||
"user.attribute": "emailVerified"
|
"user.attribute": "emailVerified"
|
||||||
"jsonType.label": "boolean"
|
"jsonType.label": "boolean"
|
||||||
"id.token.claim": "true"
|
"id.token.claim": true
|
||||||
"access.token.claim": "true"
|
"access.token.claim": true
|
||||||
"userinfo.token.claim": "true"
|
"userinfo.token.claim": true
|
||||||
|
|
||||||
- name: 'family_name'
|
- name: 'family_name'
|
||||||
protocol: 'openid-connect'
|
protocol: 'openid-connect'
|
||||||
|
|
Loading…
Reference in New Issue