def test_request_body_none(self): entry = self.get_entry(request_body=None) request_log = RequestLog.log(level=logging.DEBUG, log_entry=entry) template_value = pp_json(request_log.request_body) self.assertEqual(template_value, '')
def test_request_body_str(self): entry = self.get_entry(request_body='hello, world!') request_log = RequestLog.log(level=logging.DEBUG, log_entry=entry) template_value = pp_json(request_log.request_body) self.assertEqual(template_value, 'hello, world!')
def test_request_body_unserializable(self): entry = self.get_entry(request_body={'hello': Decimal('1.0')}) request_log = RequestLog.log(level=logging.DEBUG, log_entry=entry) template_value = pp_json(request_log.request_body) self.assertEqual(template_value, "{'hello': Decimal('1.0')}")
def test_request_body_dict(self): entry = self.get_entry(request_body={'hello': 'world!'}) request_log = RequestLog.log(level=logging.DEBUG, log_entry=entry) template_value = pp_json(request_log.request_body) self.assertEqual(template_value, '{\n "hello": "world!"\n}')