-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Make APIClient.force_authenticate()
work with user=None
#8212
Conversation
We should have an added test for the case that was broken before to ensure it doesn't crop up again in the future. |
Done, added test which fails without my new code. |
assert 'token' not in response.data | ||
|
||
# Token only | ||
token = Token.objects.create(key='xyz', user=user) |
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.
It'd be better, in my opinion at least, to have these as 3 individual tests.
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.
Done
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 tried to rerequest review from you, but the request failed for some reason. Anyway it's ready for review again.
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.
@marksweb any chance of getting this merged?
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.
@willbeaufoy I'm afraid I don't have the ability to do that. I was just reviewing to assist the maintainers.
Perhaps @tomchristie could take a look over this?
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.
@tomchristie any chance of merging this?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Closing this PR as it's being ignored - however it works well and is ready to merge. |
Hi @willbeaufoy. I do think we want this, yes. Thanks for the prompt. |
74eb3e4
to
6149e9d
Compare
Ah great. I noticed it failed linting so I've just fixed this and pushed the update. |
Thanks @willbeaufoy 😀 |
Description
See the issue: #8211 for why this is needed.
Previously
force_authenticate()
calledlogout()
if no user is provided. However as described in the issue, there isa case where we want to authenticate with a token but not a user, so we don't want to logout in this case.