#34240: assertRedirects() doesn't preserve headers set in RequestFactory/Client
methods.
---------------------------------------------+------------------------
Reporter: Mariusz Felisiak | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: dev
Severity: Release blocker | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------------+------------------------
Similar to the #28337, HTTP headers are no longer in `extra` so they are
no longer preserved in `assertRedirects()`.
{{{#!diff
diff --git a/tests/test_client_regress/tests.py
b/tests/test_client_regress/tests.py
index aaf25e2ec4..53cdc3bf07 100644
--- a/tests/test_client_regress/tests.py
+++ b/tests/test_client_regress/tests.py
@@ -613,6 +613,18 @@ class AssertRedirectsTests(SimpleTestCase):
status_code=302,
target_status_code=302,
)
+ response = req_method(
+ "/redirect_based_on_extra_headers_1/",
+ follow=False,
+ headers={"redirect": "val"},
+ )
+ self.assertRedirects(
+ response,
+ "/redirect_based_on_extra_headers_2/",
+ fetch_redirect_response=True,
+ status_code=302,
+ target_status_code=302,
+ )
@override_settings(ROOT_URLCONF="test_client_regress.urls")
}}}
Bug in 67da22f08e05018ea968fcacbac9ac37ea925d85.
--
Ticket URL: <https://code.djangoproject.com/ticket/34240>
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 on the web visit
https://groups.google.com/d/msgid/django-updates/010701857bcb8c61-258e2f0f-c8cb-41c7-9a70-d754ef84ab02-000000%40eu-central-1.amazonses.com.