mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-14 09:03:16 +00:00
test(minimax): avoid patching SDK internals
This commit is contained in:
parent
890ee4b423
commit
035267b0a4
1 changed files with 6 additions and 7 deletions
|
|
@ -12,6 +12,7 @@ from unittest.mock import MagicMock, patch
|
|||
import httpx
|
||||
import pytest
|
||||
|
||||
import litellm
|
||||
from litellm.llms.minimax.image_generation.transformation import (
|
||||
MinimaxImageGenerationConfig,
|
||||
MinimaxImageGenerationException,
|
||||
|
|
@ -128,9 +129,7 @@ class TestMinimaxImageGenerationTransformation:
|
|||
|
||||
assert result == "https://api.minimax.io/v1/image_generation"
|
||||
|
||||
@patch("litellm.llms.minimax.image_generation.transformation.get_secret_str")
|
||||
def test_validate_environment(self, mock_get_secret):
|
||||
mock_get_secret.return_value = "test_api_key"
|
||||
def test_validate_environment(self):
|
||||
headers = {}
|
||||
|
||||
result = self.config.validate_environment(
|
||||
|
|
@ -139,15 +138,15 @@ class TestMinimaxImageGenerationTransformation:
|
|||
messages=[],
|
||||
optional_params={},
|
||||
litellm_params={},
|
||||
api_key=None,
|
||||
api_key="test_api_key",
|
||||
)
|
||||
|
||||
assert result["Authorization"] == "Bearer test_api_key"
|
||||
assert result["Content-Type"] == "application/json"
|
||||
|
||||
@patch("litellm.llms.minimax.image_generation.transformation.get_secret_str")
|
||||
def test_validate_environment_missing_api_key(self, mock_get_secret):
|
||||
mock_get_secret.return_value = None
|
||||
def test_validate_environment_missing_api_key(self, monkeypatch):
|
||||
monkeypatch.delenv("MINIMAX_API_KEY", raising=False)
|
||||
monkeypatch.setattr(litellm, "api_key", None)
|
||||
|
||||
with pytest.raises(ValueError, match="MiniMax API key is required"):
|
||||
self.config.validate_environment(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue