def test_chat_uses_fallback_when_gemini_unavailable(client): response = client.post( "/api/chat/", json={"message": "How does malware detection work?"}, ) assert response.status_code == 200 body = response.json() assert body["success"] is True assert "MalwareGuard analyzes Windows PE files" in body["response"]