Refs -- Added test for initialization of request/args/kwargs attributes in View.Setup().
@@ -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
