mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
[1.5.x] Fixed #19316 -- Set View args/kwargs/request before dispatch
Backport of ea6b95db from master.
This commit is contained in:
committed by
Claude Paroz
parent
84dc6afac7
commit
12cf9d2be3
@@ -216,6 +216,17 @@ class ViewTest(unittest.TestCase):
|
||||
response_allows = set(response['Allow'].split(', '))
|
||||
self.assertEqual(set(expected_methods + ('OPTIONS',)), response_allows)
|
||||
|
||||
def test_args_kwargs_request_on_self(self):
|
||||
"""
|
||||
Test a view only has args, kwargs & request once `as_view`
|
||||
has been called.
|
||||
"""
|
||||
bare_view = InstanceView()
|
||||
view = InstanceView.as_view()(self.rf.get('/'))
|
||||
for attribute in ('args', 'kwargs', 'request'):
|
||||
self.assertNotIn(attribute, dir(bare_view))
|
||||
self.assertIn(attribute, dir(view))
|
||||
|
||||
|
||||
class TemplateViewTest(TestCase):
|
||||
urls = 'regressiontests.generic_views.urls'
|
||||
|
||||
Reference in New Issue
Block a user