[Django] #34757: AsyncClient should follow redirects

21 views
Skip to first unread message

Django

unread,
Aug 1, 2023, 9:55:04 PM8/1/23
to django-...@googlegroups.com
#34757: AsyncClient should follow redirects
---------------------------------------------+------------------------
Reporter: Mike Lissner | Owner: nobody
Type: Uncategorized | Status: new
Component: Testing framework | Version: 4.2
Severity: Normal | Keywords: async
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------------+------------------------
In [https://docs.djangoproject.com/en/4.2/topics/testing/tools/#testing-
asynchronous-code the documentation], it says the "AsyncClient has the
same methods and signatures as the synchronous (normal) test client,"
except, "The follow parameter is not supported."

I searched Github and the tickets here, but couldn't find an explanation
for this or a ticket discussing it. Is adding support for redirects
something that's planned so that async tests of views that do redirects
are possible?

Thanks as always for everything.

--
Ticket URL: <https://code.djangoproject.com/ticket/34757>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 1, 2023, 11:56:07 PM8/1/23
to django-...@googlegroups.com
#34757: AsyncClient should follow redirects
-----------------------------------+--------------------------------------

Reporter: Mike Lissner | Owner: nobody
Type: New feature | Status: new

Component: Testing framework | Version: 4.2
Severity: Normal | Resolution:

Keywords: async | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* cc: Carlton Gibson, Andrew Godwin (added)
* type: Uncategorized => New feature


Comment:

Adding support for `follow` would required implementing an async version
of
[https://github.com/django/django/blob/24068058a63c506c300629fcc491601abc968926/django/test/client.py#L1170-L1177
_handle_redirects()]. I'm not sure if it's possible.

--
Ticket URL: <https://code.djangoproject.com/ticket/34757#comment:1>

Django

unread,
Aug 2, 2023, 2:59:10 AM8/2/23
to django-...@googlegroups.com
#34757: AsyncClient should follow redirects
-----------------------------------+------------------------------------
Reporter: Mike Lissner | Owner: nobody
Type: New feature | Status: new
Component: Testing framework | Version: 4.2
Severity: Normal | Resolution:
Keywords: async | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by Carlton Gibson):

* stage: Unreviewed => Accepted


Comment:

> Adding support for follow would required implementing an async version

of ​_handle_redirects(). I'm not sure if it's possible.

I can't immediately see why not, so I'd say let's let someone have a pop
at it. (The core loop fetching the chain of responses should work
equivalently AFAICS, at a quick glance.)

--
Ticket URL: <https://code.djangoproject.com/ticket/34757#comment:2>

Django

unread,
Aug 3, 2023, 5:54:02 PM8/3/23
to django-...@googlegroups.com
#34757: AsyncClient should follow redirects
-------------------------------------+-------------------------------------
Reporter: Mike Lissner | Owner: Olivier
| Tabone
Type: New feature | Status: assigned

Component: Testing framework | Version: 4.2
Severity: Normal | Resolution:
Keywords: async | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Olivier Tabone):

* owner: nobody => Olivier Tabone
* status: new => assigned


Comment:

I'll have a look at this one

--
Ticket URL: <https://code.djangoproject.com/ticket/34757#comment:3>

Django

unread,
Aug 18, 2023, 5:09:07 PM8/18/23
to django-...@googlegroups.com
#34757: AsyncClient should follow redirects
-------------------------------------+-------------------------------------
Reporter: Mike Lissner | Owner: Olivier
| Tabone
Type: New feature | Status: assigned
Component: Testing framework | Version: 4.2
Severity: Normal | Resolution:
Keywords: async | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Olivier Tabone):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/17168 PR]

Please review this PR

Cheers,

- Olivier

--
Ticket URL: <https://code.djangoproject.com/ticket/34757#comment:4>

Django

unread,
Aug 22, 2023, 4:26:04 AM8/22/23
to django-...@googlegroups.com
#34757: AsyncClient should follow redirects
-------------------------------------+-------------------------------------
Reporter: Mike Lissner | Owner: Olivier
| Tabone
Type: New feature | Status: assigned
Component: Testing framework | Version: 4.2
Severity: Normal | Resolution:
Keywords: async | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/34757#comment:5>

Django

unread,
Aug 23, 2023, 2:04:49 AM8/23/23
to django-...@googlegroups.com
#34757: AsyncClient should follow redirects
-------------------------------------+-------------------------------------
Reporter: Mike Lissner | Owner: Olivier
| Tabone
Type: New feature | Status: assigned
Component: Testing framework | Version: 4.2
Severity: Normal | Resolution:
Keywords: async | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"a9e0f3d3014461c2199123721899162c0876959d" a9e0f3d3]:
{{{
#!CommitTicketReference repository=""
revision="a9e0f3d3014461c2199123721899162c0876959d"
Refs #34757 -- Moved HTTP redirect logic to
django.test.client.ClientMixin.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34757#comment:6>

Django

unread,
Aug 23, 2023, 9:32:56 AM8/23/23
to django-...@googlegroups.com
#34757: AsyncClient should follow redirects
-------------------------------------+-------------------------------------
Reporter: Mike Lissner | Owner: Olivier
| Tabone
Type: New feature | Status: assigned
Component: Testing framework | Version: 4.2
Severity: Normal | Resolution:
Keywords: async | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Olivier Tabone):

* needs_better_patch: 1 => 0


Comment:

PR updated

--
Ticket URL: <https://code.djangoproject.com/ticket/34757#comment:7>

Django

unread,
Aug 30, 2023, 12:14:46 AM8/30/23
to django-...@googlegroups.com
#34757: AsyncClient should follow redirects
-------------------------------------+-------------------------------------
Reporter: Mike Lissner | Owner: Olivier
| Tabone
Type: New feature | Status: assigned
Component: Testing framework | Version: 4.2
Severity: Normal | Resolution:
Keywords: async | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/34757#comment:8>

Django

unread,
Aug 30, 2023, 12:50:18 AM8/30/23
to django-...@googlegroups.com
#34757: AsyncClient should follow redirects
-------------------------------------+-------------------------------------
Reporter: Mike Lissner | Owner: Olivier
| Tabone
Type: New feature | Status: closed

Component: Testing framework | Version: 4.2
Severity: Normal | Resolution: fixed

Keywords: async | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"3f8dbe267d35f0219277f0fe2d79915a4fb2b045" 3f8dbe2]:
{{{
#!CommitTicketReference repository=""
revision="3f8dbe267d35f0219277f0fe2d79915a4fb2b045"
Fixed #34757 -- Added support for following redirects to AsyncClient.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34757#comment:9>

Reply all
Reply to author
Forward
0 new messages