mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #32195 -- Added system check for invalid view in path() and improved error messages.
This commit is contained in:
parent
8f89454bbc
commit
3e73c65ffc
6 changed files with 65 additions and 0 deletions
|
@ -5,6 +5,7 @@ from django.core.exceptions import ImproperlyConfigured
|
|||
from django.test import SimpleTestCase
|
||||
from django.test.utils import override_settings
|
||||
from django.urls import NoReverseMatch, Resolver404, path, resolve, reverse
|
||||
from django.views import View
|
||||
|
||||
from .converters import DynamicConverter
|
||||
from .views import empty_view
|
||||
|
@ -146,6 +147,14 @@ class SimplifiedURLTests(SimpleTestCase):
|
|||
with self.assertRaisesMessage(TypeError, msg):
|
||||
path('articles/', 'invalid_view')
|
||||
|
||||
def test_invalid_view_instance(self):
|
||||
class EmptyCBV(View):
|
||||
pass
|
||||
|
||||
msg = 'view must be a callable, pass EmptyCBV.as_view(), not EmptyCBV().'
|
||||
with self.assertRaisesMessage(TypeError, msg):
|
||||
path('foo', EmptyCBV())
|
||||
|
||||
def test_whitespace_in_route(self):
|
||||
msg = (
|
||||
"URL route 'space/<int:num>/extra/<str:%stest>' cannot contain "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue