33 lines
942 B
Python
33 lines
942 B
Python
"""Integration tests for WebSocket connections."""
|
|
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
from backend.main import app
|
|
|
|
|
|
@pytest.fixture
|
|
def client():
|
|
"""Test client fixture."""
|
|
return TestClient(app)
|
|
|
|
|
|
@pytest.mark.integration
|
|
class TestWebSocketConnection:
|
|
"""Test WebSocket connections."""
|
|
|
|
def test_websocket_connection(self, client):
|
|
"""Test WebSocket connection."""
|
|
with client.websocket_connect("/ws/") as websocket:
|
|
# Connection should be established
|
|
assert websocket is not None
|
|
|
|
def test_websocket_message_handling(self, client):
|
|
"""Test WebSocket message handling."""
|
|
with client.websocket_connect("/ws/") as websocket:
|
|
# Send a test message
|
|
websocket.send_json({"type": "ping"})
|
|
# WebSocket should accept the connection
|
|
# Note: Actual message handling depends on implementation
|
|
|