Final notes

This commit is contained in:
mirai
2026-01-02 23:25:02 +03:00
parent 5cbe355660
commit 0756aab53f
5 changed files with 5 additions and 25 deletions
+1 -4
View File
@@ -1,12 +1,9 @@
# tests/test_health.py
import pytest
class TestHealth:
"""Тесты health endpoint"""
def test_health_ok(self, test_client):
"""GET /health возвращает статус"""
_, response = test_client.get("/health")
assert response.status == 200
-7
View File
@@ -1,14 +1,9 @@
# tests/test_srp.py
import base64
import pytest
import srp
class TestSRPFlow:
"""Тесты SRP аутентификации"""
def test_srp_init_success(self, test_client):
"""POST /srp/init возвращает user_id, B, salt"""
usr = srp.User(b"chat", b"testpassword")
_, A = usr.start_authentication()
@@ -27,7 +22,6 @@ class TestSRPFlow:
assert "salt" in data
def test_srp_init_missing_a(self, test_client):
"""POST /srp/init без A возвращает 400"""
_, response = test_client.post(
"/srp/init",
json={"username": "testuser"},
@@ -36,7 +30,6 @@ class TestSRPFlow:
assert response.status == 400
def test_srp_verify_invalid_session(self, test_client):
"""Verify с несуществующим user_id возвращает 401"""
_, response = test_client.post(
"/srp/verify",
json={
+1 -6
View File
@@ -1,17 +1,12 @@
# 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