accounts: test multiple attributes's readonly display (#86671)
gitea/authentic/pipeline/head This commit looks good
Details
gitea/authentic/pipeline/head This commit looks good
Details
This commit is contained in:
parent
dc5b825cd8
commit
0922437061
|
@ -18,6 +18,7 @@
|
|||
import pytest
|
||||
from django.urls import reverse
|
||||
|
||||
from authentic2 import app_settings
|
||||
from authentic2.a2_rbac.utils import get_default_ou
|
||||
from authentic2.apps.authenticators.models import LoginPasswordAuthenticator
|
||||
from authentic2.models import Attribute
|
||||
|
@ -531,3 +532,29 @@ def test_account_view_boolean(app, simple_user, settings):
|
|||
simple_user.attributes.accept = False
|
||||
resp = app.get(reverse('account_management'))
|
||||
assert 'Vrai' not in resp.text
|
||||
|
||||
|
||||
def test_account_view_multiple_attribute(app, simple_user, settings):
|
||||
Attribute.objects.create(
|
||||
name='neighborhoods',
|
||||
label='Neighborhoods',
|
||||
kind='string',
|
||||
asked_on_registration=False,
|
||||
required=False,
|
||||
user_visible=True,
|
||||
user_editable=True,
|
||||
multiple=True, # test str multi-valued attributes' serialization into claims
|
||||
)
|
||||
# mock hobo's auto declaration as an a2 profile field
|
||||
app_settings.A2_PROFILE_FIELDS = app_settings.A2_PROFILE_FIELDS + ('neighborhoods',)
|
||||
|
||||
simple_user.attributes.neighborhoods = ['Mogador', 'Père Lachaise', 'Stalingrad']
|
||||
simple_user.save()
|
||||
|
||||
utils.login(app, simple_user)
|
||||
resp = app.get(reverse('account_management'))
|
||||
assert [li.text_content() for li in resp.pyquery('dd ul li')] == [
|
||||
'Mogador',
|
||||
'Père Lachaise',
|
||||
'Stalingrad',
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue