test: migrate conftest and plugin lifecycle tests to SQLAlchemy 2.0 select() API (#34979)

This commit is contained in:
dataCenter430
2026-04-12 05:21:31 +00:00
committed by GitHub
parent 64920ef648
commit e0139f91c8
2 changed files with 12 additions and 7 deletions
@@ -1,5 +1,5 @@
import pytest
from sqlalchemy import delete
from sqlalchemy import delete, func, select
from core.db.session_factory import session_factory
from models import Tenant
@@ -61,7 +61,11 @@ class TestPluginPermissionLifecycle:
assert perm.debug_permission == TenantPluginPermission.DebugPermission.ADMINS
with session_factory.create_session() as session:
count = session.query(TenantPluginPermission).where(TenantPluginPermission.tenant_id == tenant).count()
count = session.scalar(
select(func.count())
.select_from(TenantPluginPermission)
.where(TenantPluginPermission.tenant_id == tenant)
)
assert count == 1