[pre-commit.ci lite] apply automatic fixes
This commit is contained in:
parent
ab5702677b
commit
655badb800
1 changed files with 20 additions and 20 deletions
|
|
@ -99,29 +99,29 @@ class TestSendfile:
|
||||||
rv.close()
|
rv.close()
|
||||||
|
|
||||||
def test_send_file_io_bytes(self, app, req_ctx):
|
def test_send_file_io_bytes(self, app, req_ctx):
|
||||||
"""
|
"""
|
||||||
Tests that send_file can handle file-like objects typed as IO[bytes].
|
Tests that send_file can handle file-like objects typed as IO[bytes].
|
||||||
This verifies the fix for issue #5776.
|
This verifies the fix for issue #5776.
|
||||||
"""
|
"""
|
||||||
file_content = b"this is file content"
|
file_content = b"this is file content"
|
||||||
file_obj: IO[bytes] = io.BytesIO(file_content)
|
file_obj: IO[bytes] = io.BytesIO(file_content)
|
||||||
|
|
||||||
rv = flask.send_file(
|
|
||||||
file_obj,
|
|
||||||
download_name="test.txt",
|
|
||||||
mimetype="text/plain",
|
|
||||||
as_attachment=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
assert rv.status_code == 200
|
rv = flask.send_file(
|
||||||
assert rv.direct_passthrough
|
file_obj,
|
||||||
|
download_name="test.txt",
|
||||||
|
mimetype="text/plain",
|
||||||
|
as_attachment=True,
|
||||||
|
)
|
||||||
|
|
||||||
rv.direct_passthrough = False
|
assert rv.status_code == 200
|
||||||
|
assert rv.direct_passthrough
|
||||||
|
|
||||||
assert rv.data == file_content
|
rv.direct_passthrough = False
|
||||||
assert rv.mimetype == "text/plain"
|
|
||||||
assert "attachment; filename=test.txt" in rv.headers["Content-Disposition"]
|
assert rv.data == file_content
|
||||||
rv.close()
|
assert rv.mimetype == "text/plain"
|
||||||
|
assert "attachment; filename=test.txt" in rv.headers["Content-Disposition"]
|
||||||
|
rv.close()
|
||||||
|
|
||||||
|
|
||||||
class TestUrlFor:
|
class TestUrlFor:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue