profile: add support for "french phone number" attribute type (#56541)
This commit is contained in:
parent
b50346485a
commit
dc69e1cfcf
|
@ -25,6 +25,7 @@ class Migration(migrations.Migration):
|
|||
('birthdate', 'Birthdate'),
|
||||
('fr_postcode', 'French Postcode'),
|
||||
('phone_number', 'Phone Number'),
|
||||
('fr_phone_number', 'French Phone Number'),
|
||||
('profile_image', 'Profile Image'),
|
||||
('address_auto', 'Address (autocomplete)'),
|
||||
],
|
||||
|
|
|
@ -55,6 +55,7 @@ class AttributeDefinition(models.Model):
|
|||
('birthdate', _('Birthdate')),
|
||||
('fr_postcode', _('French Postcode')),
|
||||
('phone_number', _('Phone Number')),
|
||||
('fr_phone_number', _('French Phone Number')),
|
||||
('profile_image', _('Profile Image')),
|
||||
('address_auto', _('Address (autocomplete)')),
|
||||
),
|
||||
|
|
|
@ -233,6 +233,17 @@ def test_hobo_deploy(monkeypatch, tenant_base, mocker, skeleton_dir, tmp_path):
|
|||
'asked_on_registration': False,
|
||||
'name': 'phone',
|
||||
},
|
||||
{
|
||||
'kind': 'fr_phone_number',
|
||||
'description': '',
|
||||
'required': False,
|
||||
'user_visible': True,
|
||||
'label': 'Téléphone Français',
|
||||
'disabled': False,
|
||||
'user_editable': True,
|
||||
'asked_on_registration': False,
|
||||
'name': 'fr_phone',
|
||||
},
|
||||
{
|
||||
'kind': 'string',
|
||||
'description': '',
|
||||
|
@ -380,7 +391,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() == 11
|
||||
assert Attribute.all_objects.count() == 12
|
||||
for field in env['profile']['fields']:
|
||||
if field['name'] != 'email':
|
||||
at = Attribute.all_objects.get(name=field['name'])
|
||||
|
@ -413,10 +424,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() == 15
|
||||
assert policy.attributes.filter(enabled=True).count() == 13
|
||||
assert policy.attributes.count() == 16
|
||||
assert policy.attributes.filter(enabled=True).count() == 14
|
||||
assert policy.attributes.filter(enabled=False).count() == 2
|
||||
assert policy.attributes.filter(name_format='basic').count() == 15
|
||||
assert policy.attributes.filter(name_format='basic').count() == 16
|
||||
assert (
|
||||
policy.attributes.filter(name='is_superuser', attribute_name='django_user_is_superuser').count()
|
||||
== 1
|
||||
|
@ -511,7 +522,7 @@ def test_hobo_deploy(monkeypatch, tenant_base, mocker, skeleton_dir, tmp_path):
|
|||
# test attribute kind update
|
||||
with tenant_context(tenant):
|
||||
assert Attribute.objects.filter(name='mobile', kind='string').count() == 1
|
||||
field = env['profile']['fields'][8]
|
||||
field = env['profile']['fields'][9]
|
||||
assert field['name'] == 'mobile'
|
||||
field['kind'] = 'phone_number'
|
||||
side_effect_iter = iter([meta1, meta2, RequestException(), meta3])
|
||||
|
|
Loading…
Reference in New Issue