#36966: Test client using query_params raises ValueError when following redirect
-------------------------------------+-------------------------------------
               Reporter:  Marc       |          Owner:  Marc Gibbons
  Gibbons                            |
                   Type:  Bug        |         Status:  assigned
              Component:  Testing    |        Version:  6.0
  framework                          |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 When the test client is called with `query_params` and `follow=True`, a
 `ValueError` is raised when following the redirect.

 `_follow_redirect` populates `data` from the redirect URL's query string
 via `QueryDict(url.query)`. Since `query_params` from the original request
 is never reset, both `data` and `query_params` end up non-empty,
 triggering: `ValueError: query_params and data arguments are mutually
 exclusive.`

 Ref:
 
https://github.com/django/django/blob/35dab0ad9ee2ed23101420cb0f253deda2818191/django/test/client.py#L998

 == Reproduction ==

   {{{
   def test_follow_redirect_with_query_params(self):
       self.client.get("/redirect_view/", query_params={"next": "x"},
 follow=True)  # this yells
   }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36966>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019cba277c4d-dbc4ef93-ea76-42e2-ac4d-ad4e97953685-000000%40eu-central-1.amazonses.com.

Reply via email to