From aaa03db4c7e4168d89caf5c1d2de4a3d0a7bda6b Mon Sep 17 00:00:00 2001 From: leehk Date: Fri, 18 Apr 2025 16:25:40 +0800 Subject: [PATCH] replace test that ping only --- .../backend/test_frontend_backend.py | 23 ++++--------------- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/app/tests/tests/integration/backend/test_frontend_backend.py b/app/tests/tests/integration/backend/test_frontend_backend.py index fe62d3e..b70cbf8 100644 --- a/app/tests/tests/integration/backend/test_frontend_backend.py +++ b/app/tests/tests/integration/backend/test_frontend_backend.py @@ -1,24 +1,11 @@ import pytest -import json import websockets - @pytest.mark.asyncio -async def test_chatbot_integration(): - # Send a request to the chatbot endpoint +async def test_websocket_connection(): url = "ws://backend-aimingmedai:80/ws" - data = [{"content": "Hello"}] try: - async with websockets.connect(url) as websocket: - await websocket.send(json.dumps(data)) - response = await websocket.recv() - assert response is not None - try: - response_json = json.loads(response) - assert "type" in response_json - assert "payload" in response_json - assert response_json["payload"] == "" - except json.JSONDecodeError: - assert False, "Invalid JSON response" - except Exception as e: - pytest.fail(f"Request failed: {e}") \ No newline at end of file + async with websockets.connect(url): + assert True # If the connection is established, the test passes + except Exception: + assert False # If any exception occurs, the test fails \ No newline at end of file