hack-house/tests/test_websocket.py
mirai 5cbe355660 feat: add SRP authentication, improve security
- Replace RSA key exchange with SRP (Secure Remote Password)
- Password never transmitted over network
- Add unit tests for endpoints
- Fix datetime.UTC compatibility for Python < 3.11
- Fix logger.exception usage
- Update README with new auth flow diagram
2026-01-02 23:09:00 +03:00

17 lines
664 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# tests/test_websocket.py
import pytest
class TestWebSocket:
"""Тесты WebSocket подключения"""
def test_ws_connect_no_user_id(self, test_client):
"""WebSocket без user_id отклоняется"""
_, ws = test_client.websocket("/ws/chat")
# Проверяем что соединение закрыто или вернулась ошибка
assert ws is not None
def test_ws_connect_invalid_session(self, test_client):
"""WebSocket с невалидным user_id отклоняется"""
_, ws = test_client.websocket("/ws/chat?user_id=invalid123")
assert ws is not None