summaryrefslogtreecommitdiff
path: root/tests/test_client_regress
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-01-06 19:23:42 -0500
committerGitHub <noreply@github.com>2017-01-06 19:23:42 -0500
commit8516f7c49bfaeb1fa75d16509e05ba5d0933dc58 (patch)
tree11e31c193419335725da753c993bbdb843b2e691 /tests/test_client_regress
parent12cefee5d84b3569ccbde03167c7853e8dac638f (diff)
Fixed #27698 -- Added django.test.utils.ContextList.get()
Diffstat (limited to 'tests/test_client_regress')
-rw-r--r--tests/test_client_regress/tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py
index 2c1a9b346a..1e30017d5a 100644
--- a/tests/test_client_regress/tests.py
+++ b/tests/test_client_regress/tests.py
@@ -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