don't hide virtual table, hide shadow tables.

This commit is contained in:
Alex Garcia 2024-08-14 15:39:49 -07:00
commit 751abbcc57
4 changed files with 116 additions and 51 deletions

View file

@ -664,3 +664,45 @@ async def test_in_memory_databases_forbid_writes(app_client):
# Using db.execute_write() should work:
await db.execute_write("create table foo (t text)")
assert await db.table_names() == ["foo"]
@pytest.mark.asyncio
async def test_hidden_tables(app_client):
ds = app_client.ds
db = ds.add_database(Database(ds, is_memory=True, is_mutable=True))
assert await db.hidden_table_names() == []
await db.execute("create virtual table f using fts5(a)")
assert await db.hidden_table_names() == [
'f_config',
'f_content',
'f_data',
'f_docsize',
'f_idx',
]
await db.execute("create virtual table r using rtree(id, amin, amax)")
assert await db.hidden_table_names() == [
'f_config',
'f_content',
'f_data',
'f_docsize',
'f_idx',
'r_node',
'r_parent',
'r_rowid'
]
await db.execute("create table _hideme(_)")
assert await db.hidden_table_names() == [
'_hideme',
'f_config',
'f_content',
'f_data',
'f_docsize',
'f_idx',
'r_node',
'r_parent',
'r_rowid'
]