MCPcopy
hub / github.com/django/django / test_redirect

Method test_redirect

tests/httpwrappers/tests.py:601–612  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

599
600class HttpResponseSubclassesTests(SimpleTestCase):
601 def test_redirect(self):
602 response = HttpResponseRedirect("/redirected/")
603 self.assertEqual(response.status_code, 302)
604 # Standard HttpResponse init args can be used
605 response = HttpResponseRedirect(
606 "/redirected/",
607 content="The resource has temporarily moved",
608 )
609 self.assertContains(
610 response, "The resource has temporarily moved", status_code=302
611 )
612 self.assertEqual(response.url, response.headers["Location"])
613
614 def test_redirect_lazy(self):
615 """Make sure HttpResponseRedirect works with lazy strings."""

Callers

nothing calls this directly

Calls 2

assertContainsMethod · 0.80

Tested by

no test coverage detected