fixed a bug
This commit is contained in:
@@ -47,6 +47,21 @@ def test_ai_tutor_parses_chat_completion(monkeypatch):
|
||||
assert timeout == 1.5
|
||||
|
||||
|
||||
def test_ai_tutor_resolves_openai_compatible_base_url(monkeypatch):
|
||||
endpoints = []
|
||||
|
||||
def fake_post(endpoint, **kwargs):
|
||||
endpoints.append(endpoint)
|
||||
return FakeResponse(body={"choices": [{"message": {"content": "ok"}}]})
|
||||
|
||||
monkeypatch.setattr("sentence_api.ai_tutor.requests.post", fake_post)
|
||||
tutor = AITutor("https://ai.test:8080/v1", "secret", "test-model", 1)
|
||||
|
||||
assert tutor.explain("Hello.") == "ok"
|
||||
assert endpoints == ["https://ai.test:8080/v1/chat/completions"]
|
||||
assert tutor.request_url == "https://ai.test:8080/v1/chat/completions"
|
||||
|
||||
|
||||
def test_ai_tutor_rejects_unexpected_response(monkeypatch):
|
||||
monkeypatch.setattr(
|
||||
"sentence_api.ai_tutor.requests.post",
|
||||
|
||||
Reference in New Issue
Block a user