summaryrefslogtreecommitdiff
path: root/tests/generic_views
diff options
context:
space:
mode:
authorFelipe Lee <felipe.lee.garcia@gmail.com>2019-10-30 14:14:04 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-10-30 14:43:47 +0100
commit31d1822532d716d5b2f1422372d07dd05067bfc6 (patch)
tree82fc58be90ccc89b803cb000ad05f6cdeb9e8266 /tests/generic_views
parent54a7b021125d23a248e70ba17bf8b10bc8619234 (diff)
Refs #20456 -- Added test for initialization of request/args/kwargs attributes in View.Setup().
Diffstat (limited to 'tests/generic_views')
-rw-r--r--tests/generic_views/test_base.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/generic_views/test_base.py b/tests/generic_views/test_base.py
index e48413d4a4..f6479d858c 100644
--- a/tests/generic_views/test_base.py
+++ b/tests/generic_views/test_base.py
@@ -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