mirror of
https://github.com/django/django.git
synced 2025-07-30 16:44:30 +00:00
Fixed #27698 -- Added django.test.utils.ContextList.get()
This commit is contained in:
parent
12cefee5d8
commit
8516f7c49b
2 changed files with 15 additions and 0 deletions
|
@ -961,6 +961,15 @@ class ContextTests(TestDataMixin, TestCase):
|
|||
# in every Context without needing to be added.
|
||||
self.assertEqual({'None', 'True', 'False', 'hello', 'goodbye', 'python', 'dolly'}, k.keys())
|
||||
|
||||
def test_contextlist_get(self):
|
||||
c1 = Context({'hello': 'world', 'goodbye': 'john'})
|
||||
c2 = Context({'goodbye': 'world', 'python': 'rocks'})
|
||||
k = ContextList([c1, c2])
|
||||
self.assertEqual(k.get('hello'), 'world')
|
||||
self.assertEqual(k.get('goodbye'), 'john')
|
||||
self.assertEqual(k.get('python'), 'rocks')
|
||||
self.assertEqual(k.get('nonexistent', 'default'), 'default')
|
||||
|
||||
def test_15368(self):
|
||||
# Need to insert a context processor that assumes certain things about
|
||||
# the request instance. This triggers a bug caused by some ways of
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue