diff --git a/tests/integration/authorization/test_team_admin_gate.py b/tests/integration/authorization/test_team_admin_gate.py index 2b02e90fcc5..d62a2a1a9a6 100644 --- a/tests/integration/authorization/test_team_admin_gate.py +++ b/tests/integration/authorization/test_team_admin_gate.py @@ -324,7 +324,7 @@ ROUTES: Final[tuple[Route, ...]] = ( lambda s: Call("POST", "/team/update", {"team_id": s.team_id, "max_budget": 5}), team_admin=403, others=403, org_admin=200), Route("team_update_budget_permitted", - lambda s: Call("POST", "/team/update", {"team_id": s.team_id, "max_budget": 7}), + lambda s: Call("POST", "/team/update", {"team_id": s.team_id, "max_budget": 4}), team_admin=200, others=403, org_admin=200, permission="max_budget"), Route("project_new", lambda s: Call("POST", "/project/new", {"team_id": s.team_id, "project_alias": f"matrix-{uuid.uuid4().hex}"}), @@ -414,6 +414,8 @@ def test_status_code(shared: TeamScenario, org_team: TeamScenario, route: Route, team: Final = org_team if caller in ORG_CALLERS else shared with team.gateway.scenario() as scenario: s: Final = replace(team, scenario=scenario) + if route.name == "team_update_budget_permitted": + s.gateway.post("/team/update", {"team_id": s.team_id, "max_budget": 5}) if route.permission: scenario.cleanups.enter_context(team_admin_permissions(s.gateway, (route.permission,))) call: Final = route.call(s) @@ -421,5 +423,9 @@ def test_status_code(shared: TeamScenario, org_team: TeamScenario, route: Route, assert response.status_code == route.expected(caller), ( f"{caller} {call.method} {call.path}: {response.status_code} {response.text}" ) + if route.name == "team_update_budget_permitted": + assert read_rows( + 'SELECT max_budget FROM "LiteLLM_TeamTable" WHERE team_id = %s', (s.team_id,) + ) == [{"max_budget": 4.0 if response.status_code == 200 else 5.0}] if response.status_code == 200 and route.cleanup is not None: route.cleanup(s, object_value(response.json())) diff --git a/tests/integration/providers/test_responses_bridge_incomplete.py b/tests/integration/providers/test_responses_bridge_incomplete.py index e700d17ea88..2252f1634e0 100644 --- a/tests/integration/providers/test_responses_bridge_incomplete.py +++ b/tests/integration/providers/test_responses_bridge_incomplete.py @@ -12,6 +12,8 @@ def test_chat_over_responses_deployment_returns_length_when_output_tokens_run_ou identity: Final = "responses-incomplete-" + uuid.uuid4().hex def respond(request: Request) -> Reply: + if request.method == "GET" and request.target == "/v1/models": + return Reply(body=b'{"object":"list","data":[]}') assert request.method == "POST" and request.target == "/responses", request.target assert request.headers["authorization"] == "Bearer synthetic-openai-key" body: Final = json.loads(request.body) @@ -56,7 +58,7 @@ def test_chat_over_responses_deployment_returns_length_when_output_tokens_run_ou ) assert response.status_code == 200, response.text body: Final = response.json() - assert len(wire.drain()) == 1 + assert len(tuple(request for request in wire.drain() if request.method == "POST")) == 1 assert [choice["finish_reason"] for choice in body["choices"]] == ["length"], response.text assert body["choices"][0]["message"]["content"] == "", response.text assert body["choices"][0]["message"]["role"] == "assistant", response.text @@ -69,6 +71,8 @@ def test_messages_over_responses_deployment_with_max_tokens_1_is_clamped_to_16_i identity: Final = "responses-clamp-" + uuid.uuid4().hex def respond(request: Request) -> Reply: + if request.method == "GET" and request.target == "/v1/models": + return Reply(body=b'{"object":"list","data":[]}') assert request.method == "POST" and request.target == "/responses", request.target assert request.headers["authorization"] == "Bearer synthetic-openai-key" body: Final = json.loads(request.body) @@ -132,7 +136,7 @@ def test_messages_over_responses_deployment_with_max_tokens_1_is_clamped_to_16_i ) assert response.status_code == 200, response.text body: Final = response.json() - assert len(wire.drain()) == 1 + assert len(tuple(request for request in wire.drain() if request.method == "POST")) == 1 assert body["role"] == "assistant", response.text assert body["content"] == [{"type": "text", "text": "ok"}], response.text assert body["stop_reason"] == "end_turn", response.text @@ -143,6 +147,8 @@ def test_messages_over_responses_deployment_with_max_tokens_one_reaches_openai_a identity: Final = "responses-min-tokens-" + uuid.uuid4().hex def respond(request: Request) -> Reply: + if request.method == "GET" and request.target == "/v1/models": + return Reply(body=b'{"object":"list","data":[]}') assert request.method == "POST" and request.target == "/responses", request.target assert request.headers["authorization"] == "Bearer synthetic-openai-key" body: Final = json.loads(request.body) @@ -185,6 +191,6 @@ def test_messages_over_responses_deployment_with_max_tokens_one_reaches_openai_a ) assert response.status_code == 200, response.text body: Final = response.json() - assert len(wire.drain()) == 1 + assert len(tuple(request for request in wire.drain() if request.method == "POST")) == 1 assert body["content"] == [{"type": "text", "text": "ok"}], response.text assert body["usage"]["input_tokens"] == 9 and body["usage"]["output_tokens"] == 1, response.text diff --git a/tests/store_model_in_db_tests/test_mcp_servers.py b/tests/store_model_in_db_tests/test_mcp_servers.py index 0e20880ede9..94e14798c54 100644 --- a/tests/store_model_in_db_tests/test_mcp_servers.py +++ b/tests/store_model_in_db_tests/test_mcp_servers.py @@ -157,6 +157,7 @@ async def test_create_mcp_server_direct(): # Mock server manager mock_manager.add_server = mock.AsyncMock() mock_manager.reload_servers_from_database = mock.AsyncMock() + mock_manager.get_mcp_server_by_id.return_value = None # Set up test data server_id = str(uuid.uuid4())