(self)
| 1212 | assert r.raw_content == b"\xff" |
| 1213 | |
| 1214 | def test_get_json(self): |
| 1215 | req = treq(content=None) |
| 1216 | with pytest.raises(TypeError): |
| 1217 | req.json() |
| 1218 | |
| 1219 | req = treq(content=b"") |
| 1220 | with pytest.raises(json.decoder.JSONDecodeError): |
| 1221 | req.json() |
| 1222 | |
| 1223 | req = treq(content=b"{}") |
| 1224 | assert req.json() == {} |
| 1225 | |
| 1226 | req = treq(content=b'{"a": 1}') |
| 1227 | assert req.json() == {"a": 1} |
| 1228 | |
| 1229 | req = treq(content=b"{") |
| 1230 | |
| 1231 | with pytest.raises(json.decoder.JSONDecodeError): |
| 1232 | req.json() |