mirror of
https://github.com/simonw/datasette.git
synced 2026-09-29 21:34:07 +02:00
Expose foreign key data to alter table UI
Include current foreign key metadata in the alter table page data and allow the foreign-key-targets endpoint to be read by actors with alter-table permission for a specific table. Add API and HTML data tests for the new alter-table foreign key support.
This commit is contained in:
parent
dada4de172
commit
063b04ad83
4 changed files with 46 additions and 2 deletions
|
|
@ -1252,6 +1252,17 @@ async def test_foreign_key_targets_permission_denied(ds_write):
|
|||
}
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_foreign_key_targets_allowed_for_alter_table(ds_write):
|
||||
token = write_token(ds_write, permissions=["at"])
|
||||
response = await ds_write.client.get(
|
||||
"/data/-/foreign-key-targets?table=docs",
|
||||
headers=_headers(token),
|
||||
)
|
||||
assert response.status_code == 200, response.text
|
||||
assert response.json()["ok"] is True
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_alter_table_permission_denied(ds_write):
|
||||
token = write_token(ds_write, permissions=["ir"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue