1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #28999 -- Added tests for reversing a class-based view by instance.

This commit is contained in:
Clifford Gama
2024-10-17 17:59:58 +02:00
committed by Sarah Boyce
parent 35ab2e0182
commit be138f32ed
3 changed files with 20 additions and 1 deletions

View File

@@ -522,6 +522,15 @@ class URLPatternReverse(SimpleTestCase):
with self.assertRaisesMessage(NoReverseMatch, msg):
reverse("places", kwargs={"arg1": 2})
def test_func_view_from_cbv(self):
expected = "/hello/world/"
url = reverse(views.view_func_from_cbv, kwargs={"name": "world"})
self.assertEqual(url, expected)
def test_func_view_from_cbv_no_expected_kwarg(self):
with self.assertRaises(NoReverseMatch):
reverse(views.view_func_from_cbv)
class ResolverTests(SimpleTestCase):
def test_resolver_repr(self):