Skip to content
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

OMERO.web:test login requests with JSON #6420

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

sbesson
Copy link
Member

@sbesson sbesson commented Feb 17, 2025

Depends on the improvements in ome/omero-web#607

This PR builds on top of #6419 to benefit from the refactoring and reduce conflicts as unnecessary imports are removed. Both test_login_errors and test_login_example are updated to test a login request posted either as form data or as JSON

Copy link
Member

@knabar knabar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

login_json = json.loads(login_rsp.content)
assert login_json['success']
event_context = login_json['eventContext']
login_rsp = django_client.post(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly comment to myself - this works because Client.post() encodes the passed-in data according to the given content_type for application/json and MULTIPART_CONTENT; all other content_types would cause data to be passed as is.

@will-moore
Copy link
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants