mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
skip over "queries" blocks when processing database-level metadata items (#2386)
This commit is contained in:
parent
53a8ae1871
commit
0dd41efce6
2 changed files with 21 additions and 1 deletions
|
|
@ -456,7 +456,7 @@ class Datasette:
|
|||
# step 2: database-level metadata
|
||||
for dbname, db in self._metadata_local.get("databases", {}).items():
|
||||
for key, value in db.items():
|
||||
if key == "tables":
|
||||
if key in ("tables", "queries"):
|
||||
continue
|
||||
await self.set_database_metadata(dbname, key, value)
|
||||
|
||||
|
|
|
|||
|
|
@ -173,3 +173,23 @@ async def test_get_permission(ds_client):
|
|||
# And test KeyError
|
||||
with pytest.raises(KeyError):
|
||||
ds.get_permission("missing-permission")
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_apply_metadata_json():
|
||||
ds = Datasette(
|
||||
metadata={
|
||||
"databases": {
|
||||
"legislators": {
|
||||
"tables": {"offices": {"summary": "office address or sumtin"}},
|
||||
"queries": {
|
||||
"millenntial_represetatives": {
|
||||
"summary": "Social media accounts for current legislators"
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
await ds.invoke_startup()
|
||||
assert (await ds.client.get("/")).status_code == 200
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue