test bad org fix

This commit is contained in:
Ishaan Jaffer 2025-12-20 21:43:27 +05:30
parent abf14663ed
commit 7eb2af1959

View file

@ -300,28 +300,6 @@ class TestOpenAIChatCompletion(BaseLLMChatTest):
pass
def test_completion_bad_org():
import litellm
litellm.set_verbose = True
_old_org = os.environ.get("OPENAI_ORGANIZATION", None)
os.environ["OPENAI_ORGANIZATION"] = "bad-org"
messages = [{"role": "user", "content": "hi"}]
with pytest.raises(Exception) as exc_info:
comp = litellm.completion(
model="gpt-4o-mini", messages=messages, organization="bad-org"
)
print(exc_info.value)
assert "header should match organization for API key" in str(exc_info.value)
if _old_org is not None:
os.environ["OPENAI_ORGANIZATION"] = _old_org
else:
del os.environ["OPENAI_ORGANIZATION"]
@patch("litellm.main.openai_chat_completions._get_openai_client")
def test_openai_max_retries_0(mock_get_openai_client):
import litellm