mirror of
https://github.com/django/django.git
synced 2025-08-02 10:02:41 +00:00
Fixed #24055 -- Keep reference to view class for resolve()
This commit is contained in:
parent
67235fd4ef
commit
a420f83e7d
9 changed files with 42 additions and 2 deletions
|
@ -5,6 +5,7 @@ import unittest
|
|||
import warnings
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.core.urlresolvers import resolve
|
||||
from django.http import HttpResponse
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango19Warning
|
||||
|
@ -329,6 +330,15 @@ class TemplateViewTest(TestCase):
|
|||
response = self.client.get('/template/content_type/')
|
||||
self.assertEqual(response['Content-Type'], 'text/plain')
|
||||
|
||||
def test_resolve_view(self):
|
||||
match = resolve('/template/content_type/')
|
||||
self.assertIs(match.func.view_class, TemplateView)
|
||||
self.assertEqual(match.func.view_initkwargs['content_type'], 'text/plain')
|
||||
|
||||
def test_resolve_login_required_view(self):
|
||||
match = resolve('/template/login_required/')
|
||||
self.assertIs(match.func.view_class, TemplateView)
|
||||
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango19Warning)
|
||||
@override_settings(ROOT_URLCONF='generic_views.urls')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue