diff --git a/backend/tests/test_rls_isolation.py b/backend/tests/test_rls_isolation.py index 14ed7371..5d6572e2 100644 --- a/backend/tests/test_rls_isolation.py +++ b/backend/tests/test_rls_isolation.py @@ -92,22 +92,22 @@ async def seed_rls_test_data(admin_conn): # Insert one private tree per account with explicit author_id await admin_conn.execute(f""" INSERT INTO trees ( - id, name, account_id, author_id, is_active, is_default, + id, name, tree_structure, account_id, author_id, is_active, is_default, is_public, visibility, tree_type, created_at, updated_at ) VALUES - (gen_random_uuid(), 'RLS Tree A', '{ACCOUNT_A_ID}', '{actual_user_a}', + (gen_random_uuid(), 'RLS Tree A', '[]'::jsonb, '{ACCOUNT_A_ID}', '{actual_user_a}', TRUE, FALSE, FALSE, 'private', 'troubleshooting', NOW(), NOW()), - (gen_random_uuid(), 'RLS Tree B', '{ACCOUNT_B_ID}', '{actual_user_b}', + (gen_random_uuid(), 'RLS Tree B', '[]'::jsonb, '{ACCOUNT_B_ID}', '{actual_user_b}', TRUE, FALSE, FALSE, 'private', 'troubleshooting', NOW(), NOW()) """) # One platform-owned tree_tag (global, visible to all tenants) await admin_conn.execute(f""" INSERT INTO tree_tags ( - id, name, slug, account_id, usage_count, created_at, updated_at + id, name, slug, account_id, usage_count, created_at ) VALUES ( gen_random_uuid(), 'rls-global-tag', 'rls-global-tag', - '{PLATFORM_ACCOUNT_ID}', 0, NOW(), NOW() + '{PLATFORM_ACCOUNT_ID}', 0, NOW() ) ON CONFLICT DO NOTHING """) @@ -135,7 +135,7 @@ async def conn_a(): user="resolutionflow_app", password=_APP_PASSWORD, ) await conn.execute( - "SELECT set_config('app.current_account_id', $1, true)", ACCOUNT_A_ID + "SELECT set_config('app.current_account_id', $1, false)", ACCOUNT_A_ID ) yield conn await conn.close() @@ -149,7 +149,7 @@ async def conn_b(): user="resolutionflow_app", password=_APP_PASSWORD, ) await conn.execute( - "SELECT set_config('app.current_account_id', $1, true)", ACCOUNT_B_ID + "SELECT set_config('app.current_account_id', $1, false)", ACCOUNT_B_ID ) yield conn await conn.close()