Projet

Général

Profil

0001-ldap-fix-multivalued-attributes-in-user_attributes.patch

Loïc Dachary, 25 février 2021 15:24

Télécharger (1,6 ko)

Voir les différences:

Subject: [PATCH] ldap: fix  multivalued attributes in user_attributes

 tests/test_ldap.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
tests/test_ldap.py
870 870
                'from_ldap': 'l',
871 871
                'to_user': 'locality',
872 872
            },
873
            {
874
                'from_ldap': 'o',
875
                'to_user': 'org',
876
            },
873 877
        ]
874 878
    }]
875 879

  
......
884 888
        asked_on_registration=False,
885 889
        multiple=False)
886 890

  
891
    # create a org attribute
892
    models.Attribute.objects.create(
893
        label='org',
894
        name='org',
895
        kind='string',
896
        required=False,
897
        user_visible=True,
898
        user_editable=False,
899
        asked_on_registration=False,
900
        multiple=True)
901

  
887 902
    client.post('/login/',
888 903
                {
889 904
                    'login-password-submit': '1',
......
894 909
    username = u'%s@ldap' % USERNAME
895 910
    user = User.objects.get(username=username)
896 911
    assert user.attributes.locality == u'Paris'
912
    assert sorted(user.attributes.org) == (u'EE', u'EO')
897 913
    client.session.flush()
898 914
    for i in range(5):
899 915
        client.post('/login/',
900
-