phase0: fix cross-plugin import, remove app.tenant_id, create cross-tenant v2 tests
- Fix report_generator/jobs.py: use DmsContract instead of direct DMS import
- Remove app.tenant_id from set_tenant_context (only app.current_tenant_id)
- Create tests/test_cross_tenant_security_v2.py with real RLS tests using
unprivileged crm_api role (NOSUPERUSER, NOBYPASSRLS)
- Fix existing tests referencing app.tenant_id
- Git baseline tag v-phase0-baseline at 11d6faa
- Production DB backup at /tmp/crm_backup_20260731_015514.dump
This commit is contained in:
@@ -209,11 +209,8 @@ async def test_rls_disabled_on_system_tables(db):
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_tenant_context_variable_consistency(db, tenant_a):
|
||||
"""set_tenant_context must set both app.current_tenant_id and app.tenant_id."""
|
||||
"""set_tenant_context must set app.current_tenant_id (the only standard)."""
|
||||
await set_tenant_context(db, tenant_a.id)
|
||||
|
||||
result = await db.execute(text("SELECT current_setting('app.current_tenant_id', true)"))
|
||||
assert result.scalar() == str(tenant_a.id), "app.current_tenant_id not set correctly"
|
||||
|
||||
result = await db.execute(text("SELECT current_setting('app.tenant_id', true)"))
|
||||
assert result.scalar() == str(tenant_a.id), "app.tenant_id not set correctly"
|
||||
|
||||
Reference in New Issue
Block a user