refactor: explicit DB session propagation across backend paths (#38559)

Co-authored-by: WH-2099 <wh2099@pm.me>
This commit is contained in:
Byron.wang
2026-07-15 06:48:28 +00:00
committed by GitHub
co-authored by WH-2099
parent 7d5835fbc0
commit ab3e4daa95
397 changed files with 14205 additions and 9967 deletions
@@ -214,7 +214,7 @@ class TestTenantGetAccounts(_DBTrackingTestBase):
self._create_join(db_session_with_containers, tenant.id, account1.id, TenantAccountRole.OWNER, current=False)
self._create_join(db_session_with_containers, tenant.id, account2.id, TenantAccountRole.NORMAL, current=False)
accounts = tenant.get_accounts()
accounts = tenant.get_accounts(session=db_session_with_containers)
assert len(accounts) == 2
account_ids = {a.id for a in accounts}
@@ -273,7 +273,7 @@ class TestSiteGenerateCode:
def test_generate_code_returns_string_of_correct_length(self, db_session_with_containers: Session) -> None:
"""Site.generate_code returns a code string of the requested length."""
code = Site.generate_code(8)
code = Site.generate_code(8, session=db_session_with_containers)
assert isinstance(code, str)
assert len(code) == 8
@@ -307,7 +307,7 @@ class TestSiteGenerateCode:
db_session_with_containers.add(site)
db_session_with_containers.flush()
code = Site.generate_code(8)
code = Site.generate_code(8, session=db_session_with_containers)
assert isinstance(code, str)
assert len(code) == 8