Self-hosted AI workspace.
Python
test(database): restore model endpoint isolation
Alexandre Teixeiraebcc6c524f76
diff --git a/tests/test_research_endpoint_owner_scope.py b/tests/test_research_endpoint_owner_scope.pyindex e30e5d994..a4a4b661b 100644--- a/tests/test_research_endpoint_owner_scope.py+++ b/tests/test_research_endpoint_owner_scope.py@@ -15,6 +15,7 @@ import sysimport typesfrom types import SimpleNamespacefrom unittest.mock import MagicMock+import pytest# The helper resolves `from src.database import ModelEndpoint` at call time.# Stub the module so we can hand it a fake declarative class whose column@@ -73,12 +74,17 @@ class _DB:return _Query(self._rows)[email protected](autouse=True)+def _isolate_model_endpoint(monkeypatch):+ import src.database+ monkeypatch.setattr(src.database, "ModelEndpoint", _ModelEndpoint)++def _ep(eid, owner, *, is_enabled=True):return SimpleNamespace(id=eid, owner=owner, is_enabled=is_enabled, api_key="sk-secret")def _resolve(rows, owner, endpoint_id=None):- sys.modules["src.database"].ModelEndpoint = _ModelEndpointreturn _owned_enabled_endpoint(_DB(rows), owner, endpoint_id)