mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
.blob output renderer
* _blob_hash= checking plus refactored to use new BadRequest class, refs #1050 * Replace BlobView with new .blob renderer, closes #1050 * .blob downloads on arbitrary queries, closes #1051
This commit is contained in:
parent
d6f9ff7137
commit
78b3eeaad9
12 changed files with 165 additions and 121 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import textwrap
|
||||
import pytest
|
||||
from .fixtures import ( # noqa
|
||||
app_client,
|
||||
app_client_csv_max_mb_one,
|
||||
|
|
@ -78,6 +80,22 @@ def test_table_csv_with_nullable_labels(app_client):
|
|||
assert EXPECTED_TABLE_WITH_NULLABLE_LABELS_CSV == response.text
|
||||
|
||||
|
||||
@pytest.mark.xfail
|
||||
def test_table_csv_blob_columns(app_client):
|
||||
response = app_client.get("/fixtures/binary_data.csv")
|
||||
assert response.status == 200
|
||||
assert "text/plain; charset=utf-8" == response.headers["content-type"]
|
||||
assert EXPECTED_TABLE_CSV == textwrap.dedent(
|
||||
"""
|
||||
rowid,data
|
||||
1,/fixtures/binary_data/-/blob/1/data.blob
|
||||
2,/fixtures/binary_data/-/blob/1/data.blob
|
||||
""".strip().replace(
|
||||
"\n", "\r\n"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def test_custom_sql_csv(app_client):
|
||||
response = app_client.get(
|
||||
"/fixtures.csv?sql=select+content+from+simple_primary_key+limit+2"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue