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
Add HTTP Headers fixer for Client and RequestFactory. #305
Add HTTP Headers fixer for Client and RequestFactory. #305
Conversation
) -> Iterable[tuple[Offset, TokenFunc]]: | ||
if ( | ||
isinstance(node.func, ast.Name) | ||
and "RequestFactory" in state.from_imports["django.test"] |
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.
AsyncRequestFactory
and AsyncClient
are not handled at the moment, as the keyword arguments don't start with HTTP_
I guess they would be harder to catch 🤔
6e5890c
to
0ca8fce
Compare
f3c5b7f
to
5dcf1e6
Compare
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.
Just been looking into this now I have the time, and Django 4.2 alpha 1 is out. I've made some fixes, comments on outstanding changes to make.
cd44676
to
9009a3f
Compare
Okay I’ve rewritten the implementation to resolve all noted issues. Tested against Django before your fixup commit, Sentry, and some of my clients' projects. All worked well on those. |
Thanks a lot for your help @adamchainz 🙇 |
Fixes #271
At the moment, it's just a first draft, to get the idea.
Some cases are not handled yet, and we will have to decide how far to push the handled cases :)
Used for django/django#16401