Orchestrata Ultimate › Tests › Reference › session › test_real_session_context
Tests reference — tests/session/test_real_session_context.py
Module of tests/session, split out because the directory page would be too large.
Prose pending.
tests/session/test_real_session_context.py
source · 45 tests · 526 lines
Real-infrastructure tests for SessionContext.
Covers: core.packet.packet, kernel.session_context
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestContextValidator |
69 | Test ContextValidator schema validation. |
| method | TestContextValidator.test_validate_key_valid |
72 | |
| method | TestContextValidator.test_validate_key_empty_raises |
75 | |
| method | TestContextValidator.test_validate_key_too_long_raises |
79 | |
| method | TestContextValidator.test_validate_key_invalid_chars_raises |
83 | |
| method | TestContextValidator.test_validate_key_non_string_raises |
87 | |
| method | TestContextValidator.test_validate_value_valid |
93 | |
| method | TestContextValidator.test_validate_value_non_serializable_raises |
96 | |
| method | TestContextValidator.test_validate_schema_valid |
100 | |
| method | TestContextValidator.test_validate_schema_non_dict_raises |
103 | |
| class | TestSessionContextCRUD |
115 | Test set/get/update/delete/clear with real Redis. |
| method | TestSessionContextCRUD.test_set_and_get |
118 | Set a value and get it back. |
| method | TestSessionContextCRUD.test_get_default_when_missing |
125 | Get returns default when key is missing. |
| method | TestSessionContextCRUD.test_get_default_none |
130 | Get returns None by default when key is missing. |
| method | TestSessionContextCRUD.test_set_complex_value |
135 | Set and get a complex nested value. |
| method | TestSessionContextCRUD.test_update_atomic |
143 | Update multiple keys atomically. |
| method | TestSessionContextCRUD.test_update_empty |
151 | Update with empty dict is a no-op. |
| method | TestSessionContextCRUD.test_delete_key |
156 | Delete removes the key. |
| method | TestSessionContextCRUD.test_clear_all |
162 | Clear removes all context for session. |
| class | TestCorruptedJSON |
176 | Test handling of malformed JSON data in Redis. |
| method | TestCorruptedJSON.test_get_with_corrupted_json_returns_default |
179 | Get returns default when stored JSON is corrupted. |
| method | TestCorruptedJSON.test_serialize_skips_corrupted_values |
195 | Serialize skips keys with corrupted JSON values. |
| class | TestSerializeDeserialize |
216 | Test context serialization and deserialization. |
| method | TestSerializeDeserialize.test_serialize_empty |
219 | Serialize empty context returns empty dict. |
| method | TestSerializeDeserialize.test_serialize_with_data |
224 | Serialize returns all stored context. |
| method | TestSerializeDeserialize.test_deserialize_stores_data |
233 | Deserialize stores data into Redis. |
| method | TestSerializeDeserialize.test_roundtrip_serialize_deserialize |
242 | Data survives serialize -> clear -> deserialize cycle. |
| class | TestVolkAttachment |
256 | Test Volk attach/detach/list for session routing. |
| method | TestVolkAttachment.test_attach_and_list |
259 | Attach Volks and list them. |
| method | TestVolkAttachment.test_detach_volk |
271 | Detach removes Volk from session. |
| method | TestVolkAttachment.test_get_session_volks_empty |
282 | Get Volks for session with none attached. |
| class | TestInjectExtract |
316 | Test inject_context and extract_context. |
| method | TestInjectExtract.test_inject_context_adds_session_data |
319 | Inject adds session context to packet payload. |
| method | TestInjectExtract.test_extract_context_from_packet |
329 | Extract returns payload context dict. |
| method | TestInjectExtract.test_extract_context_empty_packet |
337 | Extract returns empty dict when packet has no context. |
| class | TestSessionIsolation |
348 | Test validate_session_isolation. |
| method | TestSessionIsolation.test_valid_session_passes |
351 | Validation passes when session IDs match. |
| method | TestSessionIsolation.test_mismatched_session_raises |
357 | Validation raises when session IDs differ. |
| method | TestSessionIsolation.test_missing_session_id_raises |
364 | Validation raises when packet has no session_id. |
| class | TestRedisErrorPaths |
377 | Test error paths via bad-port Redis client swap. |
| method | TestRedisErrorPaths.test_set_redis_error_raises |
380 | Set raises when Redis is unreachable. |
| method | TestRedisErrorPaths.test_get_redis_error_raises |
389 | Get raises when Redis is unreachable. |
| method | TestRedisErrorPaths.test_delete_redis_error_raises |
397 | Delete raises when Redis is unreachable. |
| method | TestRedisErrorPaths.test_clear_redis_error_raises |
405 | Clear raises when Redis is unreachable. |
| method | TestRedisErrorPaths.test_update_redis_error_raises |
413 | Update raises when Redis is unreachable. |
| method | TestRedisErrorPaths.test_serialize_redis_error_raises |
421 | Serialize raises when Redis is unreachable. |
| class | TestConnectionFailure |
435 | Test SessionContext init with unreachable Redis. |
| method | TestConnectionFailure.test_init_unreachable_redis_raises |
438 | Constructor raises when Redis is unreachable. |
| class | TestGenericExceptionPaths |
477 | Test generic except Exception handlers via non-Redis errors. |
| method | TestGenericExceptionPaths.test_set_generic_exception |
480 | Set raises generic Exception path. |
| method | TestGenericExceptionPaths.test_get_generic_exception |
488 | Get raises generic Exception path. |
| method | TestGenericExceptionPaths.test_update_generic_exception |
496 | Update raises generic Exception path. |
| method | TestGenericExceptionPaths.test_delete_generic_exception |
504 | Delete raises generic Exception path. |
| method | TestGenericExceptionPaths.test_clear_generic_exception |
512 | Clear raises generic Exception path. |
| method | TestGenericExceptionPaths.test_serialize_generic_exception |
520 | Serialize raises generic Exception path. |