示例#1
0
    def test_all_options(self):
        target = Response(
            202, headers={'Content-Type': 'application/json'}, body='the body')

        result = target.json()
        self.assertEqual(result, {
            'status': 202,
            'body': 'the body',
            'headers': {'Content-Type': 'application/json'}})
示例#2
0
 def test_falsey_body(self):
     target = Response(200, body=[])
     result = target.json()
     self.assertEqual(result, {'status': 200, 'body': []})
示例#3
0
 def test_sparse(self):
     target = Response(200)
     result = target.json()
     self.assertEqual(result, {'status': 200})