Refs #20456 -- Added test for initialization of request/args/kwargs attributes in View.Setup().
This commit is contained in:
parent
54a7b02112
commit
31d1822532
|
@ -259,6 +259,17 @@ class ViewTest(SimpleTestCase):
|
|||
with self.assertRaisesMessage(AttributeError, msg):
|
||||
TestView.as_view()(self.rf.get('/'))
|
||||
|
||||
def test_setup_adds_args_kwargs_request(self):
|
||||
request = self.rf.get('/')
|
||||
args = ('arg 1', 'arg 2')
|
||||
kwargs = {'kwarg_1': 1, 'kwarg_2': 'year'}
|
||||
|
||||
view = View()
|
||||
view.setup(request, *args, **kwargs)
|
||||
self.assertEqual(request, view.request)
|
||||
self.assertEqual(args, view.args)
|
||||
self.assertEqual(kwargs, view.kwargs)
|
||||
|
||||
def test_direct_instantiation(self):
|
||||
"""
|
||||
It should be possible to use the view by directly instantiating it
|
||||
|
|
Loading…
Reference in New Issue