.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:
Simon Willison 2020-10-29 15:01:38 -07:00 committed by GitHub
commit 78b3eeaad9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 165 additions and 121 deletions

View file

@ -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"