test_middleware.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:django-audit-tools 作者: PeRDy 项目源码 文件源码
def test_response_json(self):
        # Create a json response object
        json_dict = {'response': 'test'}
        json_template = dumps(json_dict)
        response = HttpResponse(json_template, content_type='application/json')

        response_data = self.middleware._extract_response_data(response)

        self.assertIn('json', response_data['type'])
        self.assertEqual(200, response_data['status_code'])
        self.assertEqual(json_dict, response_data['content'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号