-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Fix SessionRefresh flow for new architecture #112
🐛 Fix SessionRefresh flow for new architecture #112
Conversation
eaff13f
to
4809d7c
Compare
b7fbb42
to
515e6c7
Compare
515e6c7
to
d0561ae
Compare
018fa6d
to
a4b45eb
Compare
django_login_response = client.get(login_url) | ||
assert django_login_response.status_code == 302 | ||
|
||
# simulate login to Keycloak | ||
redirect_uri = keycloak_login(django_login_response["Location"], session=session) | ||
|
||
# complete the login flow on our end | ||
callback_response = client.get(redirect_uri) | ||
|
||
assert callback_response.status_code == 302 | ||
assert callback_response["Location"] == "/admin/" | ||
|
||
# a user was created | ||
assert django_user_model.objects.count() == 1 | ||
|
||
admin_response = client.get("/admin/") | ||
|
||
# User was successfully logged in | ||
assert admin_response.status_code == 200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can clean up a bunch of assertions here that are not relevant for this test. The fact that a user is created after a valid login is already tested and asserted in another test, and removing the asserts makes it much more obvious what is actually being tested in this test.
You should always aim for a visual block structure in tests:
setup some thing
setup another thing
call the system under test
assert a thing
assert another thing
a4b45eb
to
e04febd
Compare
e04febd
to
ebed28c
Compare
previously, the callback view never had access to the config class, because this is deleted after successful login by mozilla-django-oidc, causing the callbackview to crash
ebed28c
to
bcd89a2
Compare
this field was never actually used, and it does not make sense to make settings that refer to Django stuff (URL patterns in this case) manually configurable instead of programmatically. It caused issues in Open Forms (#4435) where it required manual action from admins if it was kept as a model field.
previously it was not possible to fall back on falsy defaults (empty lists, sets, strings, etc.), this made it required to specify settings such as OIDC_EXEMPT_URLS in order to not let the SessionRefresh middleware crash
and add missing testapp migrations
71f86d4
to
9cdd3c6
Compare
issue: open-formulieren/open-forms#4435