Files
mtusi2026lab2/student-tests/test_health.py
T
ricoromaandClaude Opus 5.5 7b775a29a9 chore: carry over lab 1 solution into lab 2 skeleton
Copy the committed lab 1 sources as-is: src/, student-tests/, bench/,
Dockerfile, docker-compose.yml, pyproject.toml, uv.lock,
.python-version, config_example.toml, AGENTS.md, CLAUDE.md, .claude/,
openspec/, .graphifyignore and KNOWN_ISSUES.md. Lab 1 evidence stays
in the lab 1 repository.

Merge the new skeleton files with own sections: Makefile (lab 2
targets plus own run, docker, bench and common targets), .gitignore,
.dockerignore and .env.example. Rename the image to
mtusi-messenger:lab2 and point AGENTS.md at lab 2.

The application is still the in-memory lab 1 implementation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 22:11:46 +03:00

29 lines
911 B
Python

"""Спек `health`: live и ready без идентификации, вне `/api/v1`."""
import pytest
from api_client import Actor, Api
from contract import assert_ok
HEALTH = ("/health/live", "/health/ready")
@pytest.mark.spec("health", "Процесс жив")
def test_live(api: Api) -> None:
resp = api.request("GET", "/health/live")
assert assert_ok(resp, 200, "Health") == {"status": "ok"}
@pytest.mark.spec("health", "Сервис запущен")
def test_ready(api: Api) -> None:
resp = api.request("GET", "/health/ready")
assert assert_ok(resp, 200, "Health") == {"status": "ok"}
@pytest.mark.spec("health", "Неизвестный X-User-Id")
def test_unknown_user_is_ignored(api: Api) -> None:
ghost = Actor.unregistered()
for path in HEALTH:
resp = api.request("GET", path, actor=ghost)
assert assert_ok(resp, 200, "Health") == {"status": "ok"}