chore: carry lab 3 over
- carry the lab 3 solution over from mtusi2026lab3-safronov (solution/bvt2301-safronov, ce89eba): src, migrations, student-tests, bench, openspec, .claude, infra/haproxy and infra/valkey, own scripts, Dockerfile, compose, pyproject and uv lock - merge Makefile, .gitignore and .dockerignore (the lab 3 versions only add lines to the skeleton, which is the same in lab 4) and .env.example (lab 4 skeleton names listed in the header) - rename the compose project to mtusi-lab4 and the image to :lab4 so the stand does not reuse the lab 3 containers and volumes - update AGENTS.md for lab 4: current lab, origin commit, contract and test files of the new skeleton Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
"""Спек `data-storage`.
|
||||
|
||||
Гонки — в `test_race.py`; рестарт, отказы БД и пул — исключения в
|
||||
`spec_coverage.py`.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
from api_client import API, Actor, Api
|
||||
from contract import assert_ok
|
||||
|
||||
|
||||
@pytest.mark.spec("data-storage", "Созданное видно сразу")
|
||||
def test_created_user_visible_at_once(api: Api) -> None:
|
||||
for _ in range(5):
|
||||
actor = api.register()
|
||||
resp = api.request("GET", f"{API}/users/me", actor=actor)
|
||||
assert assert_ok(resp, 200, "User") == actor.user
|
||||
|
||||
|
||||
@pytest.mark.spec("data-storage", "Порядок участников")
|
||||
def test_member_order_kept(api: Api, alice: Actor, bob: Actor) -> None:
|
||||
# порядок [bob, alice] из запроса не совпадает с порядком регистрации;
|
||||
# «в том числе после рестарта» — evidence/storage/restart.md
|
||||
created = api.create_chat(bob, alice, title="Порядок участников")
|
||||
expected = [bob.id, alice.id]
|
||||
assert created["member_ids"] == expected
|
||||
|
||||
resp = api.request("GET", f"{API}/chats/{created['id']}", actor=alice)
|
||||
assert assert_ok(resp, 200, "Chat")["member_ids"] == expected
|
||||
|
||||
listed = {
|
||||
chat["id"]: chat["member_ids"]
|
||||
for page in api.chat_pages(alice)
|
||||
for chat in page["items"]
|
||||
}
|
||||
assert listed[created["id"]] == expected
|
||||
Reference in New Issue
Block a user