mirror of
https://github.com/langgenius/dify.git
synced 2026-10-29 18:07:39 +08:00
refactor: explicit DB session propagation across backend paths (#38559)
Co-authored-by: WH-2099 <wh2099@pm.me>
This commit is contained in:
@@ -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}
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user