agent/authentic: set required_on_login on Attribute (#56502)
This commit is contained in:
parent
cf3c111e94
commit
0b3c8a03eb
|
@ -82,6 +82,7 @@ class Command(hobo_deploy.Command):
|
|||
'required',
|
||||
'searchable',
|
||||
'disabled',
|
||||
'required_on_login',
|
||||
):
|
||||
if key in attribute:
|
||||
setattr(attr, key, attribute[key])
|
||||
|
|
|
@ -266,6 +266,18 @@ def test_hobo_deploy(monkeypatch, tenant_base, mocker, skeleton_dir, tmp_path):
|
|||
'asked_on_registration': False,
|
||||
'name': 'birthdate',
|
||||
},
|
||||
{
|
||||
'kind': 'boolean',
|
||||
'description': '',
|
||||
'required': False,
|
||||
'user_visible': True,
|
||||
'label': 'CGU?',
|
||||
'disabled': False,
|
||||
'user_editable': False,
|
||||
'asked_on_registration': True,
|
||||
'required_on_login': True,
|
||||
'name': 'cgu',
|
||||
},
|
||||
]
|
||||
},
|
||||
'variables': {
|
||||
|
@ -368,7 +380,7 @@ def test_hobo_deploy(monkeypatch, tenant_base, mocker, skeleton_dir, tmp_path):
|
|||
assert user.is_staff is True
|
||||
from authentic2.models import Attribute
|
||||
|
||||
assert Attribute.all_objects.count() == 10
|
||||
assert Attribute.all_objects.count() == 11
|
||||
for field in env['profile']['fields']:
|
||||
if field['name'] != 'email':
|
||||
at = Attribute.all_objects.get(name=field['name'])
|
||||
|
@ -382,6 +394,7 @@ def test_hobo_deploy(monkeypatch, tenant_base, mocker, skeleton_dir, tmp_path):
|
|||
assert at.asked_on_registration == field['asked_on_registration']
|
||||
assert at.user_visible == field['user_visible']
|
||||
assert at.user_editable == field['user_editable']
|
||||
assert at.required_on_login == field.get('required_on_login', False)
|
||||
for at in Attribute.all_objects.all():
|
||||
assert [field for field in env['profile']['fields'] if field['name'] == at.name]
|
||||
|
||||
|
@ -400,10 +413,10 @@ def test_hobo_deploy(monkeypatch, tenant_base, mocker, skeleton_dir, tmp_path):
|
|||
assert policy.authn_request_signed is False
|
||||
assert policy.accepted_name_id_format == ['uuid']
|
||||
assert policy.default_name_id_format == 'uuid'
|
||||
assert policy.attributes.count() == 14
|
||||
assert policy.attributes.filter(enabled=True).count() == 12
|
||||
assert policy.attributes.count() == 15
|
||||
assert policy.attributes.filter(enabled=True).count() == 13
|
||||
assert policy.attributes.filter(enabled=False).count() == 2
|
||||
assert policy.attributes.filter(name_format='basic').count() == 14
|
||||
assert policy.attributes.filter(name_format='basic').count() == 15
|
||||
assert (
|
||||
policy.attributes.filter(name='is_superuser', attribute_name='django_user_is_superuser').count()
|
||||
== 1
|
||||
|
|
Loading…
Reference in New Issue