feat: реализация второй лабы по тз

This commit is contained in:
Enterxx2
2026-10-11 18:14:20 +03:00
parent a6c74c9bb0
commit ea2b432a22
100 changed files with 3416 additions and 428 deletions
+27
View File
@@ -0,0 +1,27 @@
$ make test-failures
BASE_URL="http://localhost:8080" RUN_FAILURE_TESTS=1 poetry run pytest student-tests/test_dependency_failures.py -s
/Users/enterxx/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
warnings.warn(
============================= test session starts ==============================
platform darwin -- Python 3.12.12, pytest-9.1.1, pluggy-1.6.0 -- /Users/enterxx/Library/Caches/pypoetry/virtualenvs/max2-TbR4RJXC-py3.12/bin/python
cachedir: .pytest_cache
rootdir: /Users/enterxx/Desktop/university/4course/mtusi2026lab2
configfile: pyproject.toml
plugins: anyio-4.15.1
collecting ... collected 4 items
student-tests/test_dependency_failures.py::test_valkey_down_cache_is_bypassed PASSED
student-tests/test_dependency_failures.py::test_logout_during_valkey_outage_is_not_resurrected PASSED
student-tests/test_dependency_failures.py::test_postgres_down_returns_bounded_503_and_no_anonymous_access PASSED
student-tests/test_dependency_failures.py::test_session_survives_postgres_restart PASSED
============================== 4 passed in 11.94s ==============================
$ docker compose logs --no-log-prefix --since 2026-10-11T14:41:19Z api | grep WARNING
2026-10-11 14:41:20.418 | WARNING | infrastructure.dependencies.cache:mark_failed:69 - Valkey недоступен (ConnectionError): кэш сессий обходится 5.0 с, запросы идут в PostgreSQL
2026-10-11 14:41:20.434 | WARNING | infrastructure.services.auth_service.auth_service:logout:88 - Сессия отозвана в PostgreSQL, но запись кэша не удалена: она истечёт по TTL кэша
2026-10-11 14:41:23.079 | WARNING | infrastructure.services.auth_service.auth_service:logout:88 - Сессия отозвана в PostgreSQL, но запись кэша не удалена: она истечёт по TTL кэша
2026-10-11 14:41:25.665 | WARNING | infrastructure.utils.repository_utils:wrapper:34 - Request to DATABASE || Object: PostgresSessionRepository || Function: get_active || failed || Error: gaierror
2026-10-11 14:41:25.712 | WARNING | infrastructure.utils.repository_utils:wrapper:34 - Request to DATABASE || Object: PostgresUserRepository || Function: create || failed || Error: gaierror
2026-10-11 14:41:25.719 | WARNING | infrastructure.utils.repository_utils:wrapper:34 - Request to DATABASE || Object: PostgresUserRepository || Function: get_credentials || failed || Error: gaierror
+89
View File
@@ -0,0 +1,89 @@
$ make test-expiry
docker compose --profile expiry up -d --build --wait api-short-ttl
#1 [internal] load local bake definitions
#1 reading from stdin 597B done
#1 DONE 0.0s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 642B done
#2 DONE 0.0s
#3 [internal] load metadata for docker.io/library/python:3.12.12-slim-bookworm
#3 DONE 0.0s
#4 [internal] load .dockerignore
#4 transferring context: 328B done
#4 DONE 0.0s
#5 [1/7] FROM docker.io/library/python:3.12.12-slim-bookworm@sha256:593bd06efe90efa80dc4eee3948be7c0fde4134606dd40d8dd8dbcade98e669c
#5 resolve docker.io/library/python:3.12.12-slim-bookworm@sha256:593bd06efe90efa80dc4eee3948be7c0fde4134606dd40d8dd8dbcade98e669c done
#5 DONE 0.0s
#6 [internal] load build context
#6 transferring context: 117.69kB 0.0s done
#6 DONE 0.0s
#7 [3/7] COPY poetry.lock pyproject.toml ./
#7 CACHED
#8 [2/7] WORKDIR /app
#8 CACHED
#9 [5/7] COPY migrations ./migrations
#9 CACHED
#10 [4/7] RUN pip install --no-cache-dir "poetry==2.2.1" && poetry install --only main --no-root --no-interaction
#10 CACHED
#11 [6/7] COPY src ./src
#11 CACHED
#12 [7/7] RUN useradd --system --uid 10001 --no-create-home app
#12 CACHED
#13 exporting to image
#13 exporting layers done
#13 exporting manifest sha256:38c2dfc7141796ce2219a46fa351316f15c1c687a9a09ec702887d0f351165ce done
#13 exporting config sha256:1ab109ba0df31f1aa4ef7fca42802a75b11b456dfa73dcb4ec54117b4909cbc0 done
#13 exporting attestation manifest sha256:0131ba669988c7b2d51762370da624bd434ef64b4ea09b95b4a6e12458b0a1f8 done
#13 exporting manifest list sha256:95d9d58148c7c6842d3fbb4b4531522da5e203f013ddedd1e566fcd118a6c71c done
#13 naming to docker.io/library/mtusi-messenger:lab2 done
#13 unpacking to docker.io/library/mtusi-messenger:lab2 done
#13 DONE 0.0s
#14 resolving provenance for metadata file
#14 DONE 0.0s
mtusi-messenger:lab2 Built
Container messenger-lab2-valkey-1 Running
Container messenger-lab2-postgres-1 Running
Container messenger-lab2-api-short-ttl-1 Recreate
Container messenger-lab2-api-short-ttl-1 Recreated
Container messenger-lab2-postgres-1 Waiting
Container messenger-lab2-postgres-1 Healthy
Container messenger-lab2-api-short-ttl-1 Starting
Container messenger-lab2-api-short-ttl-1 Started
Container messenger-lab2-valkey-1 Waiting
Container messenger-lab2-api-short-ttl-1 Waiting
Container messenger-lab2-postgres-1 Waiting
Container messenger-lab2-valkey-1 Healthy
Container messenger-lab2-postgres-1 Healthy
Container messenger-lab2-api-short-ttl-1 Healthy
EXPIRY_BASE_URL=http://localhost:8081 poetry run pytest student-tests/test_expiry.py -s; \
status=$?; docker compose --profile expiry stop api-short-ttl; exit $status
/Users/enterxx/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
warnings.warn(
============================= test session starts ==============================
platform darwin -- Python 3.12.12, pytest-9.1.1, pluggy-1.6.0 -- /Users/enterxx/Library/Caches/pypoetry/virtualenvs/max2-TbR4RJXC-py3.12/bin/python
cachedir: .pytest_cache
rootdir: /Users/enterxx/Desktop/university/4course/mtusi2026lab2
configfile: pyproject.toml
plugins: anyio-4.15.1
collecting ... collected 2 items
student-tests/test_expiry.py::test_session_expires_after_short_ttl PASSED
student-tests/test_expiry.py::test_expires_at_matches_short_ttl PASSED
============================== 2 passed in 3.26s ===============================
Container messenger-lab2-api-short-ttl-1 Stopping
Container messenger-lab2-api-short-ttl-1 Stopped
+96
View File
@@ -0,0 +1,96 @@
== Объём данных
messages_total | messages_in_big_chat | messages_heap | history_index
----------------+----------------------+---------------+---------------
138769 | 20000 | 14 MB | 8000 kB
(1 row)
== 1. Первая страница истории (limit 50 + 1), как list_for_chat
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------
Limit (actual time=0.008..0.012 rows=51.00 loops=1)
Buffers: shared hit=4
-> Index Scan using messages_chat_id_created_at_id_idx on messages (actual time=0.007..0.009 rows=51.00 loops=1)
Index Cond: (chat_id = '01a10705-59d7-70b2-aa32-64965b148b34'::uuid)
Index Searches: 1
Buffers: shared hit=4
Planning:
Buffers: shared hit=6
Planning Time: 0.092 ms
Execution Time: 0.026 ms
(10 rows)
== 2. Страница из середины по cursor (после 10 000-го), как list_for_chat_after
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual time=0.007..0.012 rows=51.00 loops=1)
Buffers: shared hit=5
-> Index Scan using messages_chat_id_created_at_id_idx on messages (actual time=0.007..0.010 rows=51.00 loops=1)
Index Cond: ((chat_id = '01a10705-59d7-70b2-aa32-64965b148b34'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 02:46:40+00'::timestamp with time zone, '01a10705-59eb-73d8-aa15-9a1a496ee297'::uuid)))
Index Searches: 1
Buffers: shared hit=5
Planning Time: 0.044 ms
Execution Time: 0.036 ms
(8 rows)
== 3. Тот же запрос как generic plan prepared statement (так его исполняет asyncpg)
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------
Limit (actual time=0.008..0.012 rows=51.00 loops=1)
Buffers: shared hit=5
-> Index Scan using messages_chat_id_created_at_id_idx on messages (actual time=0.007..0.009 rows=51.00 loops=1)
Index Cond: ((chat_id = $1) AND (ROW(created_at, id) > ROW($2, $3)))
Index Searches: 1
Buffers: shared hit=5
Planning Time: 0.041 ms
Execution Time: 0.022 ms
(8 rows)
== 4. MAX(created_at) при вставке сообщения (монотонное время чата)
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------
Result (actual time=0.008..0.008 rows=1.00 loops=1)
Buffers: shared hit=4
InitPlan 1
-> Limit (actual time=0.007..0.007 rows=1.00 loops=1)
Buffers: shared hit=4
-> Index Only Scan Backward using messages_chat_id_created_at_id_idx on messages (actual time=0.007..0.007 rows=1.00 loops=1)
Index Cond: (chat_id = '01a10705-59d7-70b2-aa32-64965b148b34'::uuid)
Heap Fetches: 0
Index Searches: 1
Buffers: shared hit=4
Planning:
Buffers: shared hit=3
Planning Time: 0.041 ms
Execution Time: 0.015 ms
(14 rows)
== 5. Для сравнения: тот же запрос из середины БЕЗ индекса истории
(DROP INDEX внутри транзакции с ROLLBACK — индекс не теряется)
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (actual time=6.360..7.265 rows=51.00 loops=1)
Buffers: shared hit=1792
-> Gather Merge (actual time=6.360..7.262 rows=51.00 loops=1)
Workers Planned: 1
Workers Launched: 1
Buffers: shared hit=1792
-> Sort (actual time=2.069..2.073 rows=25.50 loops=2)
Sort Key: created_at, id
Sort Method: top-N heapsort Memory: 31kB
Buffers: shared hit=1792
Worker 0: Sort Method: quicksort Memory: 25kB
-> Parallel Seq Scan on messages (actual time=0.183..1.840 rows=5000.00 loops=2)
Filter: ((chat_id = '01a10705-59d7-70b2-aa32-64965b148b34'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 02:46:40+00'::timestamp with time zone, '01a10705-59eb-73d8-aa15-9a1a496ee297'::uuid)))
Rows Removed by Filter: 64384
Buffers: shared hit=1777
Planning:
Buffers: shared hit=4
Planning Time: 0.045 ms
Execution Time: 7.283 ms
(19 rows)
+54
View File
@@ -0,0 +1,54 @@
$ docker compose logs --no-log-prefix api | grep -E 'миграци|Схема БД'
2026-10-11 14:40:39.798 | INFO | infrastructure.dependencies.database:apply_migrations:156 - Схема БД в актуальной версии
2026-10-11 14:40:48.046 | INFO | infrastructure.dependencies.database:apply_migrations:156 - Схема БД в актуальной версии
$ docker compose exec -T postgres sh -c 'psql -X -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "SELECT * FROM schema_migrations"'
version | name | applied_at
---------+-----------+-------------------------------
1 | 0001_init | 2026-10-04 13:01:32.330387+00
(1 row)
$ docker compose exec -T postgres sh -c 'psql -X -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "\d+ messages"'
Table "public.messages"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
------------+--------------------------+-----------+----------+----------+----------+-------------+--------------+-------------
id | uuid | | not null | uuidv7() | plain | | |
chat_id | uuid | | not null | | plain | | |
sender_id | uuid | | not null | | plain | | |
text | text | | not null | | extended | | |
created_at | timestamp with time zone | | not null | | plain | | |
Indexes:
"messages_pkey" PRIMARY KEY, btree (id)
"messages_chat_id_created_at_id_idx" btree (chat_id, created_at, id)
Check constraints:
"messages_text_len" CHECK (char_length(text) >= 1 AND char_length(text) <= 4000)
Foreign-key constraints:
"messages_sender_member_fkey" FOREIGN KEY (chat_id, sender_id) REFERENCES chat_members(chat_id, user_id) ON DELETE CASCADE
Not-null constraints:
"messages_id_not_null" NOT NULL "id"
"messages_chat_id_not_null" NOT NULL "chat_id"
"messages_sender_id_not_null" NOT NULL "sender_id"
"messages_text_not_null" NOT NULL "text"
"messages_created_at_not_null" NOT NULL "created_at"
Access method: heap
$ docker compose exec -T postgres sh -c 'psql -X -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "\di"'
List of indexes
Schema | Name | Type | Owner | Table
--------+------------------------------------+-------+-----------+-------------------
public | chat_members_pkey | index | messenger | chat_members
public | chat_members_position_key | index | messenger | chat_members
public | chat_members_user_id_chat_id_idx | index | messenger | chat_members
public | chats_pkey | index | messenger | chats
public | messages_chat_id_created_at_id_idx | index | messenger | messages
public | messages_pkey | index | messenger | messages
public | schema_migrations_pkey | index | messenger | schema_migrations
public | sessions_pkey | index | messenger | sessions
public | sessions_user_id_idx | index | messenger | sessions
public | users_pkey | index | messenger | users
public | users_username_key | index | messenger | users
(11 rows)
+15
View File
@@ -0,0 +1,15 @@
$ make test-migrations
./scripts/check_migrations.sh
Network messenger-lab2-migrations-check_default Creating
Network messenger-lab2-migrations-check_default Created
2026-10-11 14:40:55.908 | INFO | infrastructure.dependencies.database:create_pool:69 - Установка соединения с базой данных psql
2026-10-11 14:40:55.938 | INFO | infrastructure.dependencies.database:create_pool:99 - Соединение с базой данных psql установлено. DB_NAME: messenger, pool: 2..10
пустой volume: таблиц в public = 0
2026-10-11 14:40:55.960 | INFO | infrastructure.dependencies.database:apply_migrations:151 - Применена миграция 0001_init.sql
2026-10-11 14:40:55.961 | INFO | infrastructure.dependencies.database:apply_migrations:156 - Схема БД в актуальной версии
запуск 1: schema_migrations = [(1, '0001_init')], таблиц = 6
2026-10-11 14:40:55.962 | INFO | infrastructure.dependencies.database:apply_migrations:156 - Схема БД в актуальной версии
запуск 2: schema_migrations = [(1, '0001_init')], таблиц = 6
2026-10-11 14:40:55.963 | INFO | infrastructure.dependencies.database:apply_migrations:156 - Схема БД в актуальной версии
запуск 3: schema_migrations = [(1, '0001_init')], таблиц = 6
+23
View File
@@ -0,0 +1,23 @@
$ docker inspect -f '{{.Name}} {{.State.StartedAt}}' messenger-lab2-api-1 messenger-lab2-postgres-1 messenger-lab2-valkey-1
/messenger-lab2-api-1 2026-10-11T14:40:38.947015458Z
/messenger-lab2-postgres-1 2026-10-11T12:57:22.164526672Z
/messenger-lab2-valkey-1 2026-10-11T12:57:22.228188756Z
$ docker volume ls --filter name=messenger-lab2
DRIVER VOLUME NAME
local messenger-lab2_postgres_data
$ make test-persistence ACTION_SCRIPT=scripts/restart.sh
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:8080"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
$ docker inspect -f '{{.Name}} {{.State.StartedAt}}' messenger-lab2-api-1 messenger-lab2-postgres-1 messenger-lab2-valkey-1
/messenger-lab2-api-1 2026-10-11T14:40:47.267238587Z
/messenger-lab2-postgres-1 2026-10-11T14:40:46.679260379Z
/messenger-lab2-valkey-1 2026-10-11T14:40:46.639763379Z
$ docker volume ls --filter name=messenger-lab2
DRIVER VOLUME NAME
local messenger-lab2_postgres_data
+22
View File
@@ -0,0 +1,22 @@
$ poetry run pytest student-tests/test_transactions.py student-tests/test_concurrency.py -s
/Users/enterxx/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
warnings.warn(
============================= test session starts ==============================
platform darwin -- Python 3.12.12, pytest-9.1.1, pluggy-1.6.0 -- /Users/enterxx/Library/Caches/pypoetry/virtualenvs/max2-TbR4RJXC-py3.12/bin/python
cachedir: .pytest_cache
rootdir: /Users/enterxx/Desktop/university/4course/mtusi2026lab2
configfile: pyproject.toml
plugins: anyio-4.15.1
collecting ... collected 4 items
student-tests/test_transactions.py::test_same_username_race_creates_exactly_one_user
REGISTRATION RACE: {"requests": 20, "status_201": 1, "status_409": 19, "rows_in_db": 1}
PASSED
student-tests/test_transactions.py::test_failed_chat_creation_is_rolled_back PASSED
student-tests/test_transactions.py::test_successful_chat_creation_commits_all_members PASSED
student-tests/test_concurrency.py::test_parallel_messages_are_not_lost_or_duplicated
CONCURRENCY RESULT: {"clients": 10, "messages_sent": 100, "status_201": 100, "messages_read": 100, "unique_ids": 100, "unique_texts": 100, "pages_read": 4, "send_seconds": 0.275}
PASSED
============================== 4 passed in 1.95s ===============================
+8
View File
@@ -0,0 +1,8 @@
$ make check
python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
$ make test
python3 tests/smoke.py --base-url "http://localhost:8080"
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
+109
View File
@@ -0,0 +1,109 @@
$ make student-test
BASE_URL="http://localhost:8080" poetry run pytest
/Users/enterxx/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
warnings.warn(
============================= test session starts ==============================
platform darwin -- Python 3.12.12, pytest-9.1.1, pluggy-1.6.0 -- /Users/enterxx/Library/Caches/pypoetry/virtualenvs/max2-TbR4RJXC-py3.12/bin/python
cachedir: .pytest_cache
rootdir: /Users/enterxx/Desktop/university/4course/mtusi2026lab2
configfile: pyproject.toml
testpaths: student-tests
plugins: anyio-4.15.1
collecting ... collected 93 items
student-tests/test_auth.py::test_login_returns_opaque_bearer_session PASSED [ 1%]
student-tests/test_auth.py::test_wrong_password_and_unknown_user_are_indistinguishable PASSED [ 2%]
student-tests/test_auth.py::test_malformed_basic_is_unauthorized[None] PASSED [ 3%]
student-tests/test_auth.py::test_malformed_basic_is_unauthorized[] PASSED [ 4%]
student-tests/test_auth.py::test_malformed_basic_is_unauthorized[Basic] PASSED [ 5%]
student-tests/test_auth.py::test_malformed_basic_is_unauthorized[Basic !!!not-base64!!!] PASSED [ 6%]
student-tests/test_auth.py::test_malformed_basic_is_unauthorized[Basic bm8tY29sb24taGVyZQ==] PASSED [ 7%]
student-tests/test_auth.py::test_malformed_basic_is_unauthorized[Basic //46cGFzc3dvcmQ=] PASSED [ 8%]
student-tests/test_auth.py::test_malformed_basic_is_unauthorized[Bearer some-token] PASSED [ 9%]
student-tests/test_auth.py::test_utf8_password_with_colon PASSED [ 10%]
student-tests/test_auth.py::test_basic_is_rejected_on_business_endpoints PASSED [ 11%]
student-tests/test_auth.py::test_logout_revokes_only_current_session PASSED [ 12%]
student-tests/test_auth.py::test_logout_without_token PASSED [ 13%]
student-tests/test_auth.py::test_relogin_after_logout PASSED [ 15%]
student-tests/test_auth.py::test_password_is_not_stored_in_plaintext PASSED [ 16%]
student-tests/test_concurrency.py::test_parallel_messages_are_not_lost_or_duplicated PASSED [ 17%]
student-tests/test_dependency_failures.py::test_valkey_down_cache_is_bypassed SKIPPED [ 18%]
student-tests/test_dependency_failures.py::test_logout_during_valkey_outage_is_not_resurrected SKIPPED [ 19%]
student-tests/test_dependency_failures.py::test_postgres_down_returns_bounded_503_and_no_anonymous_access SKIPPED [ 20%]
student-tests/test_dependency_failures.py::test_session_survives_postgres_restart SKIPPED [ 21%]
student-tests/test_expiry.py::test_session_expires_after_short_ttl SKIPPED [ 22%]
student-tests/test_expiry.py::test_expires_at_matches_short_ttl SKIPPED [ 23%]
student-tests/test_foreign_chat.py::test_outsider_cannot_access_chat PASSED [ 24%]
student-tests/test_foreign_chat.py::test_foreign_and_missing_chat_are_indistinguishable PASSED [ 25%]
student-tests/test_foreign_chat.py::test_chat_list_contains_only_own_chats PASSED [ 26%]
student-tests/test_health.py::test_health_endpoints_have_request_id PASSED [ 27%]
student-tests/test_health.py::test_unknown_route_uses_error_format PASSED [ 29%]
student-tests/test_invalid_json.py::test_malformed_json_on_register[{"username": "abc",] PASSED [ 30%]
student-tests/test_invalid_json.py::test_malformed_json_on_register[not json at all] PASSED [ 31%]
student-tests/test_invalid_json.py::test_malformed_json_on_register[{"text": "\xff\xfe"}] PASSED [ 32%]
student-tests/test_invalid_json.py::test_malformed_json_on_register[] PASSED [ 33%]
student-tests/test_invalid_json.py::test_malformed_json_on_create_chat_and_message[{"username": "abc",] PASSED [ 34%]
student-tests/test_invalid_json.py::test_malformed_json_on_create_chat_and_message[not json at all] PASSED [ 35%]
student-tests/test_invalid_json.py::test_malformed_json_on_create_chat_and_message[{"text": "\xff\xfe"}] PASSED [ 36%]
student-tests/test_invalid_json.py::test_malformed_json_on_create_chat_and_message[] PASSED [ 37%]
student-tests/test_invalid_json.py::test_invalid_user_payload[body0] PASSED [ 38%]
student-tests/test_invalid_json.py::test_invalid_user_payload[alice] PASSED [ 39%]
student-tests/test_invalid_json.py::test_invalid_user_payload[body2] PASSED [ 40%]
student-tests/test_invalid_json.py::test_invalid_user_payload[body3] PASSED [ 41%]
student-tests/test_invalid_json.py::test_invalid_user_payload[body4] PASSED [ 43%]
student-tests/test_invalid_json.py::test_invalid_user_payload[body5] PASSED [ 44%]
student-tests/test_invalid_json.py::test_invalid_user_payload[body6] PASSED [ 45%]
student-tests/test_invalid_json.py::test_invalid_user_payload[body7] PASSED [ 46%]
student-tests/test_invalid_json.py::test_invalid_user_payload[body8] PASSED [ 47%]
student-tests/test_invalid_json.py::test_invalid_user_payload[body9] PASSED [ 48%]
student-tests/test_invalid_json.py::test_invalid_user_payload[body10] PASSED [ 49%]
student-tests/test_invalid_json.py::test_invalid_message_payload[body0] PASSED [ 50%]
student-tests/test_invalid_json.py::test_invalid_message_payload[body1] PASSED [ 51%]
student-tests/test_invalid_json.py::test_invalid_message_payload[body2] PASSED [ 52%]
student-tests/test_invalid_json.py::test_invalid_chat_payload PASSED [ 53%]
student-tests/test_messages.py::test_empty_or_blank_message_is_rejected[] PASSED [ 54%]
student-tests/test_messages.py::test_empty_or_blank_message_is_rejected[ ] PASSED [ 55%]
student-tests/test_messages.py::test_empty_or_blank_message_is_rejected[ \n\t ] PASSED [ 56%]
student-tests/test_messages.py::test_empty_or_blank_message_is_rejected[\u3000] PASSED [ 58%]
student-tests/test_messages.py::test_message_length_is_counted_in_code_points PASSED [ 59%]
student-tests/test_messages.py::test_unicode_is_preserved PASSED [ 60%]
student-tests/test_messages.py::test_nul_character_is_rejected PASSED [ 61%]
student-tests/test_messages.py::test_sender_is_taken_from_session PASSED [ 62%]
student-tests/test_pagination.py::test_walk_message_pages[7-3-3] PASSED [ 63%]
student-tests/test_pagination.py::test_walk_message_pages[6-3-2] PASSED [ 64%]
student-tests/test_pagination.py::test_walk_message_pages[5-1-5] PASSED [ 65%]
student-tests/test_pagination.py::test_walk_message_pages[3-100-1] PASSED [ 66%]
student-tests/test_pagination.py::test_limit_can_change_between_pages PASSED [ 67%]
student-tests/test_pagination.py::test_new_message_appears_after_cursor PASSED [ 68%]
student-tests/test_pagination.py::test_cursor_is_bound_to_chat PASSED [ 69%]
student-tests/test_pagination.py::test_invalid_limit_or_cursor[params0] PASSED [ 70%]
student-tests/test_pagination.py::test_invalid_limit_or_cursor[params1] PASSED [ 72%]
student-tests/test_pagination.py::test_invalid_limit_or_cursor[params2] PASSED [ 73%]
student-tests/test_pagination.py::test_invalid_limit_or_cursor[params3] PASSED [ 74%]
student-tests/test_pagination.py::test_invalid_limit_or_cursor[params4] PASSED [ 75%]
student-tests/test_pagination.py::test_invalid_limit_or_cursor[params5] PASSED [ 76%]
student-tests/test_pagination.py::test_walk_chat_list_pages PASSED [ 77%]
student-tests/test_pagination.py::test_chat_cursor_is_bound_to_user PASSED [ 78%]
student-tests/test_transactions.py::test_same_username_race_creates_exactly_one_user PASSED [ 79%]
student-tests/test_transactions.py::test_failed_chat_creation_is_rolled_back PASSED [ 80%]
student-tests/test_transactions.py::test_successful_chat_creation_commits_all_members PASSED [ 81%]
student-tests/test_users.py::test_duplicate_username_is_conflict PASSED [ 82%]
student-tests/test_users.py::test_registration_never_returns_password PASSED [ 83%]
student-tests/test_users.py::test_invalid_password_is_rejected[None] PASSED [ 84%]
student-tests/test_users.py::test_invalid_password_is_rejected[] PASSED [ 86%]
student-tests/test_users.py::test_invalid_password_is_rejected[\u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439] PASSED [ 87%]
student-tests/test_users.py::test_invalid_password_is_rejected[xxxxxxxxxxx] PASSED [ 88%]
student-tests/test_users.py::test_invalid_password_is_rejected[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 89%]
student-tests/test_users.py::test_invalid_password_is_rejected[123456789012] PASSED [ 90%]
student-tests/test_users.py::test_password_length_is_counted_in_code_points PASSED [ 91%]
student-tests/test_users.py::test_missing_or_unknown_token_is_unauthorized[headers0] PASSED [ 92%]
student-tests/test_users.py::test_missing_or_unknown_token_is_unauthorized[headers1] PASSED [ 93%]
student-tests/test_users.py::test_missing_or_unknown_token_is_unauthorized[headers2] PASSED [ 94%]
student-tests/test_users.py::test_missing_or_unknown_token_is_unauthorized[headers3] PASSED [ 95%]
student-tests/test_users.py::test_missing_or_unknown_token_is_unauthorized[headers4] PASSED [ 96%]
student-tests/test_users.py::test_missing_or_unknown_token_is_unauthorized[headers5] PASSED [ 97%]
student-tests/test_users.py::test_x_user_id_gives_no_access PASSED [ 98%]
student-tests/test_users.py::test_current_user PASSED [100%]
======================== 87 passed, 6 skipped in 7.11s =========================