Orchestrata Ultimate › Tests › Reference › kernel › test_session_manager_extended

Tests reference — tests/kernel/test_session_manager_extended.py

Module of tests/kernel, split out because the directory page would be too large.

Prose pending.

tests/kernel/test_session_manager_extended.py

source · 28 tests · 686 lines

Comprehensive tests for kernel.session_manager to cover previously

Covers: kernel.session_manager

Kind Name Line Description
function test_user_id 67 Generate unique test user ID.
class TestSessionDataclassEdgeCases 127 Test Session dataclass paths not covered by integration tests.
method TestSessionDataclassEdgeCases.test_session_post_init_generates_session_id 130 Test that Session without session_id gets one from BaseEntity.
method TestSessionDataclassEdgeCases.test_session_to_dict_with_none_end_time 138 Test to_dict when end_time is None (active session).
method TestSessionDataclassEdgeCases.test_session_to_dict_with_end_time 148 Test to_dict when end_time is set.
method TestSessionDataclassEdgeCases.test_session_is_active_false 161 Test is_active returns False for closed and archived.
class TestSessionManagerInitErrorPaths 179 Test SessionManager init and initialize failure paths.
method TestSessionManagerInitErrorPaths.test_init_redis_connection_failure_raises 182 Test that bad Redis host during init raises redis.RedisError.
method TestSessionManagerInitErrorPaths.test_initialize_graph_connection_failure 198 Test that a bad graph URI during initialize raises Exception.
class TestSessionManagerCreateSessionErrorPaths 215 Test create_session Redis error handling.
method TestSessionManagerCreateSessionErrorPaths.test_create_session_redis_error_on_set 218 Test RedisError during set raises and does not create session.
method TestSessionManagerCreateSessionErrorPaths.test_create_session_redis_error_on_sadd_rolls_back 231 Test RedisError during sadd rolls back the session key.
class TestSessionManagerResumeSessionErrorPaths 270 Test resume_session error handling.
method TestSessionManagerResumeSessionErrorPaths.test_resume_session_redis_error 273 Test RedisError during get raises.
method TestSessionManagerResumeSessionErrorPaths.test_resume_session_invalid_json_raises_valueerror 286 Test that corrupt session data in Redis raises ValueError.
method TestSessionManagerResumeSessionErrorPaths.test_resume_session_not_found 302 Test ValueError when session key does not exist.
class TestSessionManagerGetActiveSessions 313 Test get_active_sessions edge cases.
method TestSessionManagerGetActiveSessions.test_get_active_sessions_removes_stale_session_id 316 Test that stale session IDs in user set are cleaned up.
method TestSessionManagerGetActiveSessions.test_get_active_sessions_skips_closed_sessions 331 Test that closed sessions are excluded from active list.
method TestSessionManagerGetActiveSessions.test_get_active_sessions_returns_only_active 346 Test that only active sessions are returned.
class TestSessionManagerQuerySessionHistory 371 Test query_session_history status filter path.
method TestSessionManagerQuerySessionHistory.test_query_session_history_with_status_filter 374 Test querying history with status filter.
method TestSessionManagerQuerySessionHistory.test_query_session_history_without_status_filter 402 Test querying history without status filter.
class TestSessionManagerArchiveVolkEdges 430 archive_session materializes real WORKED_ON / WORKED_ON_BY edges for
method TestSessionManagerArchiveVolkEdges.test_archive_session_links_existing_volk_and_skips_missing 435
method TestSessionManagerArchiveVolkEdges.test_archive_session_no_volks_writes_no_edges 493 An empty volks list must skip the edge-write query entirely
class TestSessionManagerArchiveConnectivity 524 archive_session's graph-side Session node must be reachable from the
method TestSessionManagerArchiveConnectivity.test_archive_session_links_session_to_project 530
class TestSessionManagerDeleteExpiredSessions 559 Test delete_expired_sessions and internal helpers.
method TestSessionManagerDeleteExpiredSessions.test_delete_expired_sessions_removes_old_sessions 562 Test that expired sessions are deleted.
method TestSessionManagerDeleteExpiredSessions.test_delete_expired_sessions_skips_invalid_json 578 Test that invalid session JSON is skipped during expiration scan.
method TestSessionManagerDeleteExpiredSessions.test_delete_expired_sessions_preserves_future_sessions 595 Test delete_expired_sessions when no session keys are expired.
method TestSessionManagerDeleteExpiredSessions.test_collect_expired_sessions_skips_bad_data 618 Test _collect_expired_sessions handles corrupt JSON gracefully.
method TestSessionManagerDeleteExpiredSessions.test_batch_delete_expired_sessions_empty_list 632 Test _batch_delete_expired_sessions returns 0 for empty input.
method TestSessionManagerDeleteExpiredSessions.test_batch_delete_expired_sessions_redis_error 639 Test RedisError during batch delete raises.
method TestSessionManagerDeleteExpiredSessions.test_fetch_all_session_data_redis_error 654 Test RedisError during batch fetch raises.
method TestSessionManagerDeleteExpiredSessions.test_fetch_all_session_data_valid 667 Test _fetch_all_session_data returns data in order.