From 40b36735baba875f4b9174aa94a5ed1774fcdc31 Mon Sep 17 00:00:00 2001 From: moe-berri Date: Sun, 25 Oct 2026 20:42:31 -0700 Subject: [PATCH] test(chatgpt): keep destination rejection assertions focused --- .../chat/test_chatgpt_chat_transformation.py | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/unit/llms/chatgpt/chat/test_chatgpt_chat_transformation.py b/tests/unit/llms/chatgpt/chat/test_chatgpt_chat_transformation.py index 6222b542d66..78fbea29c6b 100644 --- a/tests/unit/llms/chatgpt/chat/test_chatgpt_chat_transformation.py +++ b/tests/unit/llms/chatgpt/chat/test_chatgpt_chat_transformation.py @@ -441,17 +441,20 @@ async def test_client_login_cannot_be_redirected_to_another_host( **credential, } ) + async def request() -> None: + if endpoint == "chat": + if async_call: + await litellm.acompletion(**params, messages=[{"role": "user", "content": "Hello"}]) + else: + litellm.completion(**params, messages=[{"role": "user", "content": "Hello"}]) + elif async_call: + await litellm.aresponses(**params, input="Hello") + else: + litellm.responses(**params, input="Hello") + with respx.mock as transport: with pytest.raises(litellm.BadRequestError, match="official HTTPS ChatGPT endpoint"): - if endpoint == "chat": - if async_call: - await litellm.acompletion(**params, messages=[{"role": "user", "content": "Hello"}]) - else: - litellm.completion(**params, messages=[{"role": "user", "content": "Hello"}]) - elif async_call: - await litellm.aresponses(**params, input="Hello") - else: - litellm.responses(**params, input="Hello") + await request() assert len(transport.calls) == 0