Projet

Général

Profil

0003-idp_oidc-add-a-simple-oidc-client-fixture-47900.patch

Benjamin Dauvergne, 03 décembre 2020 09:53

Télécharger (1,79 ko)

Voir les différences:

Subject: [PATCH 3/5] idp_oidc: add a simple oidc client fixture (#47900)

 tests/test_idp_oidc.py | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
tests/test_idp_oidc.py
135 135
]
136 136

  
137 137

  
138
@pytest.fixture(params=OIDC_CLIENT_PARAMS)
139
def oidc_client(request, superuser, app, simple_user, oidc_settings):
138
def make_client(app, superuser, params=None):
140 139
    Attribute.objects.create(
141 140
        name='cityscape_image',
142 141
        label='cityscape',
......
154 153
    response.form.set('ou', get_default_ou().pk)
155 154
    response.form.set('unauthorized_url', 'https://example.com/southpark/')
156 155
    response.form.set('redirect_uris', 'https://example.com/callbac%C3%A9')
157
    for key, value in request.param.items():
156
    for key, value in (params or {}).items():
158 157
        response.form.set(key, value)
159 158
    response = response.form.submit().follow()
160 159
    assert OIDCClient.objects.count() == 1
......
163 162
    return client
164 163

  
165 164

  
165
@pytest.fixture
166
def client(app, superuser):
167
    return make_client(app, superuser, {})
168

  
169

  
170
@pytest.fixture(params=OIDC_CLIENT_PARAMS)
171
def oidc_client(request, superuser, app, simple_user, oidc_settings):
172
    return make_client(app, superuser, request.param)
173

  
174

  
166 175
@pytest.fixture
167 176
def normal_oidc_client(superuser, app, simple_user):
168 177
    url = reverse('admin:authentic2_idp_oidc_oidcclient_add')
169
-