Opened 9 years ago
Closed 9 years ago
#25808 closed New feature (wontfix)
Setting to allow django.test.Client default requests to follow=True
Reported by: | Adam | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
There should be a way to allow the django.test.Client to default its requests to follow=True instead of having to mark it in each request. Something in settings TEST_AUTO_FOLLOW = True
would trigger it as an opt-in setting.
Change History (4)
follow-up: 2 comment:1 by , 9 years ago
comment:2 by , 9 years ago
That's what I had tried before realizing that it wasn't a property on the Client but rather the requests issued by the Client (.get(), .post(), etc)
comment:3 by , 9 years ago
I agree we shouldn't add a setting. What we could do a default_follow
class attribute to Client
which would default to "unset" (e.g. None
). Then we'd also change the default of follow
on the request method to None
and have them use follow if follow is not None else self.default_follow if self.default_follow is not None else None
. Is it worth it?
comment:4 by , 9 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Closing as wontfix pending a stronger rationale for the feature.
I'm not sure this use case is common enough to add yet another setting.
What about subclassing
django.test.Client
and using theTestCase.client_class
attribute instead?