()
| 1220 | |
| 1221 | |
| 1222 | def test_stream_zip(): |
| 1223 | import zipfile |
| 1224 | |
| 1225 | response = wrappers.Response() |
| 1226 | with contextlib.closing(zipfile.ZipFile(response.stream, mode="w")) as z: |
| 1227 | z.writestr("foo", b"bar") |
| 1228 | |
| 1229 | buffer = BytesIO(response.get_data()) |
| 1230 | with contextlib.closing(zipfile.ZipFile(buffer, mode="r")) as z: |
| 1231 | assert z.namelist() == ["foo"] |
| 1232 | assert z.read("foo") == b"bar" |
| 1233 | |
| 1234 | |
| 1235 | class TestSetCookie: |