/
Mihaham
/
Table-Time
Обзор
Документация
Войти
/
Mihaham
/
Table-Time
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
services/api/tests/test_coverage_extra.py
46 строк
1 KB
MihahamYT
feat: games catalog, 90%+ test coverage, MkDocs ready for GitVerse
14 июн 2026, 10:45
14 июн 2026, 10:45
03c79f9
Код
Авторство
О чём код?
import uuid from tests.conftest import auth_header, guest_auth def test_spectator_http_forbidden(client): token1, _ = guest_auth(client, "Host") created = client.post( "/api/v1/sessions", json={"display_name": "Host", "max_players": 4}, headers=auth_header(token1), ) code = created.json()["invite_code"] session_id = created.json()["id"] token2, _ = guest_auth(client, "P2") client.post( "/api/v1/sessions/join", json={"invite_code": code, "channel": "web", "display_name": "P2"}, headers=auth_header(token2), ) token3, _ = guest_auth(client, "Spec") client.post( "/api/v1/sessions/join", json={"invite_code": code, "channel": "web", "display_name": "Spec", "role": "spectator"}, headers=auth_header(token3), ) started = client.post( f"/api/v1/sessions/{session_id}/games", json={"plugin_id": "dice_board"}, headers=auth_header(token1), ) game_id = started.json()["game_id"] r = client.post( f"/api/v1/games/{game_id}/actions", json={"action_id": str(uuid.uuid4()), "action_type": "roll_dice", "payload": {}}, headers={**auth_header(token3), "X-Channel": "web"}, ) assert r.status_code == 403 def test_auth_register_validation(client): r = client.post( "/api/v1/auth/register", json={"email": "not-an-email", "password": "short"}, ) assert r.status_code == 422