Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip over "queries" blocks when processing database-level metadata items #2386

Merged
merged 3 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion datasette/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ async def apply_metadata_json(self):
# 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)

Expand Down
20 changes: 20 additions & 0 deletions tests/test_internals_datasette.py
Original file line number Diff line number Diff line change
Expand Up @@ -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