mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Fixed 500 error on /-/metadata page
This commit is contained in:
parent
f853d5592e
commit
93c65d29ba
2 changed files with 13 additions and 0 deletions
|
|
@ -4,6 +4,8 @@ from .base import RenderMixin
|
||||||
|
|
||||||
|
|
||||||
class JsonDataView(RenderMixin):
|
class JsonDataView(RenderMixin):
|
||||||
|
name = "json_data"
|
||||||
|
|
||||||
def __init__(self, datasette, filename, data_callback):
|
def __init__(self, datasette, filename, data_callback):
|
||||||
self.ds = datasette
|
self.ds = datasette
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@ from .fixtures import ( # noqa
|
||||||
app_client_with_hash,
|
app_client_with_hash,
|
||||||
app_client_with_memory,
|
app_client_with_memory,
|
||||||
make_app_client,
|
make_app_client,
|
||||||
|
METADATA,
|
||||||
)
|
)
|
||||||
|
import json
|
||||||
import pytest
|
import pytest
|
||||||
import re
|
import re
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
|
@ -899,3 +901,12 @@ def test_binary_data_display(app_client):
|
||||||
assert expected_tds == [
|
assert expected_tds == [
|
||||||
[str(td) for td in tr.select("td")] for tr in table.select("tbody tr")
|
[str(td) for td in tr.select("td")] for tr in table.select("tbody tr")
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def test_metadata_json_html(app_client):
|
||||||
|
response = app_client.get(
|
||||||
|
"/-/metadata"
|
||||||
|
)
|
||||||
|
assert response.status == 200
|
||||||
|
pre = Soup(response.body, "html.parser").find("pre")
|
||||||
|
assert METADATA == json.loads(pre.text)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue