tests/idp_oidc: use new app for calls to the token endpoint (#85643)
This commit is contained in:
parent
28afd8c425
commit
fccc8b59a1
|
@ -169,3 +169,9 @@ def client_authentication_headers(oidc_client):
|
|||
|
||||
def bearer_authentication_headers(access_token):
|
||||
return {'Authorization': 'Bearer %s' % str(access_token)}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def rp_app(app_factory):
|
||||
'''Webtest app to use for calls from the RP, like HTTP Post to the token endpoint.'''
|
||||
return app_factory()
|
||||
|
|
|
@ -231,7 +231,7 @@ def test_login_from_client_with_home_url(oidc_client, app, simple_user, settings
|
|||
@pytest.mark.parametrize('do_not_ask_again', [(True,), (False,)])
|
||||
@pytest.mark.parametrize('login_first', [(True,), (False,)])
|
||||
def test_authorization_code_sso(
|
||||
login_first, do_not_ask_again, oidc_client, oidc_settings, simple_user, app, caplog, rf
|
||||
login_first, do_not_ask_again, oidc_client, oidc_settings, simple_user, app, rp_app, caplog, rf
|
||||
):
|
||||
redirect_uri = oidc_client.redirect_uris.split()[0]
|
||||
params = {
|
||||
|
@ -321,7 +321,7 @@ def test_authorization_code_sso(
|
|||
assert query['state'] == ['xxx']
|
||||
|
||||
token_url = make_url('oidc-token')
|
||||
response = app.post(
|
||||
response = rp_app.post(
|
||||
token_url,
|
||||
params={
|
||||
'grant_type': 'authorization_code',
|
||||
|
@ -499,7 +499,9 @@ def assert_authorization_response(response, fragment=False, **kwargs):
|
|||
|
||||
|
||||
@pytest.mark.parametrize('oidc_client', OIDC_CLIENT_PARAMS, indirect=True)
|
||||
def test_invalid_request(oidc_client, caplog, oidc_settings, simple_user, app, make_client, app_factory):
|
||||
def test_invalid_request(
|
||||
oidc_client, caplog, oidc_settings, simple_user, app, rp_app, make_client, app_factory
|
||||
):
|
||||
redirect_uri = oidc_client.redirect_uris.split()[0]
|
||||
if oidc_client.authorization_flow == oidc_client.FLOW_AUTHORIZATION_CODE:
|
||||
fragment = False
|
||||
|
@ -958,7 +960,6 @@ def test_invalid_request(oidc_client, caplog, oidc_settings, simple_user, app, m
|
|||
|
||||
# check expired codes
|
||||
if oidc_client.authorization_flow == oidc_client.FLOW_AUTHORIZATION_CODE:
|
||||
rp_app = app_factory()
|
||||
assert OIDCCode.objects.count() == 1
|
||||
oidc_code = OIDCCode.objects.get()
|
||||
assert oidc_code.is_valid()
|
||||
|
|
Loading…
Reference in New Issue