mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Hide tables starting with an _, refs #2104
This commit is contained in:
parent
a395256c8c
commit
7818e8b9d1
3 changed files with 31 additions and 0 deletions
|
|
@ -1018,6 +1018,21 @@ async def test_hidden_sqlite_stat1_table():
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_hide_tables_starting_with_underscore():
|
||||
ds = Datasette()
|
||||
db = ds.add_memory_database("test_hide_tables_starting_with_underscore")
|
||||
await db.execute_write("create table normal (id integer primary key, name text)")
|
||||
await db.execute_write("create table _hidden (id integer primary key, name text)")
|
||||
data = (
|
||||
await ds.client.get(
|
||||
"/test_hide_tables_starting_with_underscore.json?_show_hidden=1"
|
||||
)
|
||||
).json()
|
||||
tables = [(t["name"], t["hidden"]) for t in data["tables"]]
|
||||
assert tables == [("normal", False), ("_hidden", True)]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize("db_name", ("foo", r"fo%o", "f~/c.d"))
|
||||
async def test_tilde_encoded_database_names(db_name):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue