Ticket #13092: test_key_in_context_1.diff
File test_key_in_context_1.diff, 1.7 KB (added by , 15 years ago) |
---|
-
django/test/utils.py
19 19 else: 20 20 return super(ContextList, self).__getitem__(key) 21 21 22 def __contains__(self, key): 23 try: 24 value = self[key] 25 except KeyError: 26 return False 27 return True 22 28 23 29 def instrumented_test_render(self, context): 24 30 """ -
tests/regressiontests/test_client_regress/models.py
598 598 "Context variables can be retrieved from a single context" 599 599 response = self.client.get("/test_client_regress/request_data/", data={'foo':'whiz'}) 600 600 self.assertEqual(response.context.__class__, Context) 601 self.assertTrue('get-foo' in response.context) 601 602 self.assertEqual(response.context['get-foo'], 'whiz') 602 603 self.assertEqual(response.context['request-foo'], 'whiz') 603 604 self.assertEqual(response.context['data'], 'sausage') … … 613 614 response = self.client.get("/test_client_regress/request_data_extended/", data={'foo':'whiz'}) 614 615 self.assertEqual(response.context.__class__, ContextList) 615 616 self.assertEqual(len(response.context), 2) 617 self.assertTrue('get-foo' in response.context) 616 618 self.assertEqual(response.context['get-foo'], 'whiz') 617 619 self.assertEqual(response.context['request-foo'], 'whiz') 618 620 self.assertEqual(response.context['data'], 'bacon')