Projet

Général

Profil

0001-tests-fix-auth_saml-tests-48117.patch

Paul Marillonnet, 29 octobre 2020 12:34

Télécharger (1,54 ko)

Voir les différences:

Subject: [PATCH] tests: fix auth_saml tests (#48117)

    * as per changes introduced in #47760
 tests/test_auth_saml.py | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
tests/test_auth_saml.py
108 108
        'attribute': 'first_name',
109 109
        'saml_attribute': 'first_name',
110 110
    }
111
    with pytest.raises(MappingError, match='no value for first_name'):
111
    with pytest.raises(MappingError, match='no value'):
112 112
        adapter.action_set_attribute(user, idp, saml_attributes, mapping)
113 113

  
114 114

  
115 115
@pytest.mark.parametrize('action_name', ['add-role', 'toggle-role'])
116
def test_provision_add_role(db, simple_role, action_name):
116
def test_provision_add_role(db, simple_role, action_name, caplog):
117 117
    from authentic2_auth_saml.adapters import AuthenticAdapter
118 118

  
119 119
    adapter = AuthenticAdapter()
......
167 167
    assert simple_role not in user.roles.all()
168 168
    user.delete()
169 169

  
170
    # on missing mandatory attribute, no user is created
171
    del saml_attributes['mail']
172
    assert adapter.lookup_user(idp, saml_attributes) is None
173

  
174 170
    # simulate no attribute value
175 171
    saml_attributes['first_name'] = []
176 172
    attribute_mapping = [
177
-