Fixed 500 error on /-/metadata page

This commit is contained in:
Simon Willison 2019-05-03 16:40:24 -04:00
commit 93c65d29ba
2 changed files with 13 additions and 0 deletions

View file

@ -4,6 +4,8 @@ from .base import RenderMixin
class JsonDataView(RenderMixin):
name = "json_data"
def __init__(self, datasette, filename, data_callback):
self.ds = datasette
self.filename = filename

View file

@ -5,7 +5,9 @@ from .fixtures import ( # noqa
app_client_with_hash,
app_client_with_memory,
make_app_client,
METADATA,
)
import json
import pytest
import re
import urllib.parse
@ -899,3 +901,12 @@ def test_binary_data_display(app_client):
assert expected_tds == [
[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)