()
| 82 | |
| 83 | |
| 84 | def test_object_attachment_requires_name(): |
| 85 | with pytest.raises(TypeError, match="attachment"): |
| 86 | send_file( |
| 87 | io.BytesIO(b"test"), environ, mimetype="text/plain", as_attachment=True |
| 88 | ) |
| 89 | |
| 90 | rv = send_file( |
| 91 | io.BytesIO(b"test"), environ, as_attachment=True, download_name="test.txt" |
| 92 | ) |
| 93 | assert rv.headers["Content-Disposition"] == "attachment; filename=test.txt" |
| 94 | rv.close() |
| 95 | |
| 96 | |
| 97 | @pytest.mark.parametrize( |