tests/test_auth.py::test_login_returns_opaque_bearer_session PASSED [ 0%] tests/test_auth.py::test_each_login_issues_a_different_token PASSED [ 1%] tests/test_auth.py::test_password_with_colon_works PASSED [ 2%] tests/test_auth.py::test_unicode_password_works PASSED [ 3%] tests/test_auth.py::test_wrong_password_and_unknown_user_look_identical PASSED [ 4%] tests/test_auth.py::test_login_requires_basic_scheme PASSED [ 5%] tests/test_auth.py::test_business_endpoints_require_bearer PASSED [ 6%] tests/test_auth.py::test_x_user_id_cannot_override_bearer_identity PASSED [ 7%] tests/test_auth.py::test_logout_revokes_only_current_session PASSED [ 8%] tests/test_auth.py::test_logout_twice_returns_401 PASSED [ 8%] tests/test_auth.py::test_session_expires_after_ttl PASSED [ 9%] tests/test_auth.py::test_token_is_stored_only_as_sha256_key PASSED [ 10%] tests/test_auth.py::test_password_is_not_stored_in_plaintext PASSED [ 11%] tests/test_auth.py::test_login_rejects_out_of_range_password_like_wrong_password PASSED [ 12%] tests/test_auth.py::test_malformed_basic_credentials_return_401 PASSED [ 13%] tests/test_auth.py::test_unknown_user_takes_comparable_time_to_wrong_password PASSED [ 14%] tests/test_chats.py::test_create_and_get_chat PASSED [ 15%] tests/test_chats.py::test_chat_is_not_visible_to_outsider PASSED [ 16%] tests/test_chats.py::test_chat_creation_requires_creator_in_members PASSED [ 16%] tests/test_chats.py::test_chat_payload_boundaries[payload0] PASSED [ 17%] tests/test_chats.py::test_chat_payload_boundaries[payload1] PASSED [ 18%] tests/test_chats.py::test_duplicate_members_are_rejected PASSED [ 19%] tests/test_chats.py::test_unknown_member_is_rejected PASSED [ 20%] tests/test_chats.py::test_chat_exact_title_limit_is_accepted PASSED [ 21%] tests/test_chats.py::test_chat_list_hides_chats_without_membership PASSED [ 22%] tests/test_chats.py::test_nonexistent_chat_returns_404 PASSED [ 23%] tests/test_chats.py::test_failed_chat_creation_leaves_no_partial_data PASSED [ 24%] tests/test_chats.py::test_chat_list_pagination_and_order PASSED [ 25%] tests/test_chats.py::test_chat_endpoints_require_bearer PASSED [ 25%] tests/test_concurrency.py::test_parallel_registration_of_same_username_creates_exactly_one_user PASSED [ 26%] tests/test_concurrency.py::test_100_messages_from_10_clients PASSED [ 27%] tests/test_concurrency.py::test_chat_creation_in_parallel_is_atomic PASSED [ 28%] tests/test_concurrency.py::test_parallel_registration_of_distinct_usernames_all_succeed PASSED [ 29%] tests/test_concurrency.py::test_parallel_logins_issue_distinct_valid_tokens PASSED [ 30%] tests/test_concurrency.py::test_parallel_logout_of_same_token_succeeds_once PASSED [ 31%] tests/test_concurrency.py::test_message_limit_is_exact_under_concurrency PASSED [ 32%] tests/test_concurrency.py::test_failed_chat_insert_rolls_back_whole_transaction PASSED [ 33%] tests/test_constraints.py::test_duplicate_username_is_rejected_by_database PASSED [ 33%] tests/test_constraints.py::test_message_requires_existing_chat PASSED [ 34%] tests/test_constraints.py::test_duplicate_membership_is_rejected_by_database PASSED [ 35%] tests/test_errors.py::test_missing_token_returns_401 PASSED [ 36%] tests/test_errors.py::test_garbage_token_returns_401 PASSED [ 37%] tests/test_errors.py::test_malformed_json_returns_400 PASSED [ 38%] tests/test_errors.py::test_not_found_returns_404 PASSED [ 39%] tests/test_errors.py::test_method_not_allowed_preserves_405 PASSED [ 40%] tests/test_errors.py::test_unhandled_exception_is_hidden_from_client PASSED [ 41%] tests/test_errors.py::test_success_response_contains_request_id PASSED [ 41%] tests/test_failures.py::test_redis_down_gives_503_for_login_and_protected_endpoints PASSED [ 42%] tests/test_failures.py::test_redis_down_keeps_registration_working PASSED [ 43%] tests/test_failures.py::test_database_down_with_valid_session_gives_503 PASSED [ 44%] tests/test_failures.py::test_dependency_failure_never_authenticates_anonymous_requests PASSED [ 45%] tests/test_health.py::test_liveness PASSED [ 46%] tests/test_health.py::test_readiness PASSED [ 47%] tests/test_health.py::test_readiness_is_503_when_database_is_down PASSED [ 48%] tests/test_health.py::test_business_request_is_503_when_database_is_down PASSED [ 49%] tests/test_history_plan.py::test_history_page_uses_composite_index PASSED [ 50%] tests/test_limits.py::test_message_limit_rejects_without_deleting_confirmed_messages PASSED [ 50%] tests/test_limits.py::test_in_flight_limit_returns_429_and_recovers PASSED [ 51%] tests/test_messages.py::test_send_and_list_message PASSED [ 52%] tests/test_messages.py::test_invalid_message_text[] PASSED [ 53%] tests/test_messages.py::test_invalid_message_text[ ] PASSED [ 54%] tests/test_messages.py::test_invalid_message_text[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 55%] tests/test_messages.py::test_extra_message_field_is_rejected PASSED [ 56%] tests/test_messages.py::test_messages_are_private_to_chat_members PASSED [ 57%] tests/test_messages.py::test_pagination_has_no_duplicates PASSED [ 58%] tests/test_messages.py::test_cursor_cannot_be_used_for_another_chat PASSED [ 58%] tests/test_messages.py::test_limit_boundaries[0-400] PASSED [ 59%] tests/test_messages.py::test_limit_boundaries[1-200] PASSED [ 60%] tests/test_messages.py::test_limit_boundaries[100-200] PASSED [ 61%] tests/test_messages.py::test_limit_boundaries[101-400] PASSED [ 62%] tests/test_messages.py::test_message_exact_max_length_is_accepted PASSED [ 63%] tests/test_messages.py::test_nonexistent_chat_messages_return_404 PASSED [ 64%] tests/test_messages.py::test_unauthenticated_requests_are_rejected PASSED [ 65%] tests/test_messages.py::test_messages_survive_new_login PASSED [ 66%] tests/test_messages.py::test_history_order_is_created_at_then_id PASSED [ 66%] tests/test_migrations.py::test_upgrade_creates_all_tables PASSED [ 67%] tests/test_migrations.py::test_upgrade_twice_is_idempotent_and_keeps_data PASSED [ 68%] tests/test_migrations.py::test_models_and_migrations_are_in_sync PASSED [ 69%] tests/test_pagination.py::test_garbage_cursor_returns_400[not-base64-%%%] PASSED [ 70%] tests/test_pagination.py::test_garbage_cursor_returns_400[bm90IGpzb24=] PASSED [ 71%] tests/test_pagination.py::test_garbage_cursor_returns_400[WzEsIDIsIDNd] PASSED [ 72%] tests/test_pagination.py::test_garbage_cursor_returns_400[eyJraW5kIjogIm1lc3NhZ2VzIn0=] PASSED [ 73%] tests/test_pagination.py::test_cursor_without_timezone_is_rejected PASSED [ 74%] tests/test_pagination.py::test_chat_list_cursor_is_bound_to_its_owner PASSED [ 75%] tests/test_pagination.py::test_messages_cursor_is_not_accepted_by_chat_list PASSED [ 75%] tests/test_pagination.py::test_limit_can_change_between_pages PASSED [ 76%] tests/test_pagination.py::test_message_sent_after_reading_last_page_is_seen_with_cursor PASSED [ 77%] tests/test_sessions.py::test_session_key_ttl_matches_expires_at PASSED [ 78%] tests/test_sessions.py::test_session_ttl_is_absolute_and_not_extended_by_activity PASSED [ 79%] tests/test_sessions.py::test_logout_removes_session_key PASSED [ 80%] tests/test_sessions.py::test_expired_session_is_rejected_everywhere PASSED [ 81%] tests/test_sessions.py::test_relogin_after_expiry_issues_new_working_token PASSED [ 82%] tests/test_sessions.py::test_tampered_token_is_rejected PASSED [ 83%] tests/test_sessions.py::test_session_of_deleted_user_is_rejected PASSED [ 83%] tests/test_sessions.py::test_redis_flush_invalidates_all_sessions PASSED [ 84%] tests/test_sessions.py::test_sessions_survive_redis_restart PASSED [ 85%] tests/test_users.py::test_register_does_not_leak_password PASSED [ 86%] tests/test_users.py::test_get_current_user PASSED [ 87%] tests/test_users.py::test_invalid_user_payloads[body0] PASSED [ 88%] tests/test_users.py::test_invalid_user_payloads[body1] PASSED [ 89%] tests/test_users.py::test_invalid_user_payloads[body2] PASSED [ 90%] tests/test_users.py::test_invalid_user_payloads[body3] PASSED [ 91%] tests/test_users.py::test_invalid_user_payloads[body4] PASSED [ 91%] tests/test_users.py::test_invalid_user_payloads[body5] PASSED [ 92%] tests/test_users.py::test_invalid_user_payloads[body6] PASSED [ 93%] tests/test_users.py::test_invalid_user_payloads[body7] PASSED [ 94%] tests/test_users.py::test_invalid_user_payloads[body8] PASSED [ 95%] tests/test_users.py::test_invalid_user_payloads[body9] PASSED [ 96%] tests/test_users.py::test_password_length_boundaries_are_accepted PASSED [ 97%] tests/test_users.py::test_extra_user_field_is_rejected PASSED [ 98%] tests/test_users.py::test_duplicate_username_returns_conflict PASSED [ 99%] tests/test_users.py::test_user_exact_length_boundaries_are_accepted PASSED [100%] ============================= 112 passed in 38.60s =============================