MCPcopy
hub / github.com/django/django / test_basic_edit_GET_string_PK

Method test_basic_edit_GET_string_PK

tests/admin_views/tests.py:408–422  ·  view source on GitHub ↗

GET on the change_view (when passing a string as the PK argument for a model with an integer PK field) redirects to the index page with a message saying the object doesn't exist.

(self)

Source from the content-addressed store, hash-verified

406 self.assertEqual(response.status_code, 200)
407
408 def test_basic_edit_GET_string_PK(self):
409 """
410 GET on the change_view (when passing a string as the PK argument for a
411 model with an integer PK field) redirects to the index page with a
412 message saying the object doesn't exist.
413 """
414 response = self.client.get(
415 reverse("admin:admin_views_section_change", args=(quote("abc/<b>"),)),
416 follow=True,
417 )
418 self.assertRedirects(response, reverse("admin:index"))
419 self.assertEqual(
420 [m.message for m in response.context["messages"]],
421 ["section with ID “abc/<b>” doesn’t exist. Perhaps it was deleted?"],
422 )
423
424 def test_basic_edit_GET_old_url_redirect(self):
425 """

Callers

nothing calls this directly

Calls 4

reverseFunction · 0.90
quoteFunction · 0.90
assertRedirectsMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected