python3: use DjangoWebtestResponse.text in test_idp_oidc (#32445)

This commit is contained in:
Paul Marillonnet 2019-04-09 11:58:03 +02:00
parent 52edd31e3f
commit 2864f57af9
1 changed files with 6 additions and 6 deletions

View File

@ -182,7 +182,7 @@ def test_authorization_code_sso(login_first, oidc_settings, oidc_client, simple_
response = response.follow()
assert response.request.path == reverse('oidc-authorize')
if oidc_client.authorization_mode != OIDCClient.AUTHORIZATION_MODE_NONE:
assert 'a2-oidc-authorization-form' in response.content
assert 'a2-oidc-authorization-form' in response.text
assert OIDCAuthorization.objects.count() == 0
assert OIDCCode.objects.count() == 0
assert OIDCAccessToken.objects.count() == 0
@ -312,8 +312,8 @@ def test_authorization_code_sso(login_first, oidc_settings, oidc_client, simple_
}
logout_url = make_url('oidc-logout', params=params)
response = app.get(logout_url)
assert 'You have been logged out' in response.content
assert 'https://example.com/?state=xyz' in response.content
assert 'You have been logged out' in response.text
assert 'https://example.com/?state=xyz' in response.text
assert '_auth_user_id' not in app.session
else:
response = app.get(make_url('account_management'))
@ -607,7 +607,7 @@ def test_invalid_request(caplog, oidc_settings, oidc_client, simple_user, app):
'prompt': 'consent',
})
response = app.get(authorize_url)
assert 'a2-oidc-authorization-form' in response.content
assert 'a2-oidc-authorization-form' in response.text
# check all authorization have been deleted, it's our policy
assert OIDCAuthorization.objects.count() == 0
if oidc_client.authorization_mode == oidc_client.AUTHORIZATION_MODE_NONE:
@ -619,7 +619,7 @@ def test_invalid_request(caplog, oidc_settings, oidc_client, simple_user, app):
authorize.expired = now() - datetime.timedelta(days=2)
authorize.save()
response = app.get(authorize_url)
assert 'a2-oidc-authorization-form' in response.content
assert 'a2-oidc-authorization-form' in response.text
authorize.expired = now() + datetime.timedelta(days=2)
authorize.scopes = 'openid profile'
authorize.save()
@ -810,7 +810,7 @@ def test_role_control_access(login_first, oidc_settings, oidc_client, simple_use
# user not authorized
response = app.get(authorize_url)
assert 'https://example.com/southpark/' in response.content
assert 'https://example.com/southpark/' in response.text
# user authorized
simple_user.roles.add(role_authorized)