コード例 #1
0
 def test_data(self):
     """extract_post_request() returns request.json_body data."""
     # Empty data.
     request = self.request_factory()
     context = contextextractors.extract_json_context(request)
     self.assertEqual(context, {})
     # Not empty.
     request = self.request_factory({'dummy': 'hello world!'})
     context = contextextractors.extract_json_context(request)
     self.assertEqual(context, request.json_body)
コード例 #2
0
 def test_data(self):
     """extract_post_request() returns request.json_body data."""
     # Empty data.
     request = self.request_factory()
     context = contextextractors.extract_json_context(request)
     self.assertEqual(context, {})
     # Not empty.
     request = self.request_factory({'dummy': 'hello world!'})
     context = contextextractors.extract_json_context(request)
     self.assertEqual(context, request.json_body)
コード例 #3
0
 def test_copy(self):
     """extract_post_request() returns copy of request's json_body."""
     request = self.request_factory({'dummy': 'hello world!'})
     context = contextextractors.extract_json_context(request)
     self.assertFalse(context is request.json_body)
     del context['dummy']
     self.assertEqual(context, {})
     self.assertTrue('dummy' in request.json_body)
コード例 #4
0
 def test_copy(self):
     """extract_post_request() returns copy of request's json_body."""
     request = self.request_factory({'dummy': 'hello world!'})
     context = contextextractors.extract_json_context(request)
     self.assertFalse(context is request.json_body)
     del context['dummy']
     self.assertEqual(context, {})
     self.assertTrue('dummy' in request.json_body)