mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-22 00:31:44 +00:00
test(proxy): model missing organizations in MCP auth fixtures
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
c4ad6194a0
commit
1b69a5b0a4
2 changed files with 11 additions and 1 deletions
|
|
@ -5739,9 +5739,15 @@ class TestMCPDcrBridgeDelegateAdmission:
|
|||
prisma and are swallowed (``_safe_fetch`` / the SCIM gate's fail-open), so their checks
|
||||
skip. Yields the ``get_key_object`` mock so callers can assert the sealed ``key_hash`` was
|
||||
the reload key."""
|
||||
from litellm.proxy.auth.auth_checks import OrganizationNotFoundError
|
||||
|
||||
get_key_object = AsyncMock(return_value=return_value, side_effect=side_effect)
|
||||
get_org_object = AsyncMock(side_effect=OrganizationNotFoundError("Organization doesn't exist in db."))
|
||||
patchers = [
|
||||
patch("litellm.proxy.auth.auth_checks.get_key_object", get_key_object),
|
||||
patch( # test-quality-ok: central auth now resolves org limits; this fixture models a missing org row
|
||||
"litellm.proxy.auth.user_api_key_auth.get_org_object", get_org_object
|
||||
),
|
||||
patch("litellm.proxy.proxy_server.prisma_client", MagicMock()),
|
||||
patch("litellm.proxy.proxy_server.user_api_key_cache", MagicMock()),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -11870,9 +11870,13 @@ async def test_oauth_credential_write_keeps_virtual_key_permissions(
|
|||
from litellm.proxy._experimental.mcp_server import mcp_server_manager
|
||||
from litellm.proxy._experimental.mcp_server.bridge_token_flow import authorize_oauth_credential_request
|
||||
from litellm.proxy._types import UserAPIKeyAuth, hash_token
|
||||
from litellm.proxy.auth.auth_checks import jwt_key_mapping_cache_key
|
||||
from litellm.proxy.auth.auth_checks import OrganizationNotFoundError, jwt_key_mapping_cache_key
|
||||
|
||||
handler, signing_key = jwt_oauth_identity
|
||||
monkeypatch.setattr(
|
||||
"litellm.proxy.auth.user_api_key_auth.get_org_object",
|
||||
AsyncMock(side_effect=OrganizationNotFoundError("Organization doesn't exist in db.")),
|
||||
)
|
||||
key: Final = "sk-oauth-permission-test"
|
||||
hashed: Final = hash_token(key)
|
||||
credential: Final = UserAPIKeyAuth(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue