Orchestrata Ultimate › Tests › Reference › postman › test_router
Tests reference — tests/postman/test_router.py
Module of tests/postman, split out because the directory page would be too large.
Prose pending.
tests/postman/test_router.py
source · 74 tests · 1167 lines
Comprehensive tests for RoutingEngine (router.py).
Covers: postman.exceptions, postman.router, postman.types
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestRoutingEngineInitialization |
70 | Test RoutingEngine initialization and configuration. |
| method | TestRoutingEngineInitialization.test_default_initialization |
73 | Test initialization with default cache TTL. |
| method | TestRoutingEngineInitialization.test_custom_cache_ttl |
84 | Test initialization with custom cache TTL. |
| method | TestRoutingEngineInitialization.test_zero_cache_ttl |
89 | Test initialization with zero cache TTL (caching disabled). |
| method | TestRoutingEngineInitialization.test_registered_agents_set |
94 | Test that registered agents set is properly initialized. |
| method | TestRoutingEngineInitialization.test_routing_type_constants |
107 | Test that routing type constants are defined. |
| class | TestRoutingTypeDetection |
121 | Test routing type detection from recipient patterns. |
| method | TestRoutingTypeDetection.test_get_routing_type_direct |
124 | Test detection of direct routing. |
| method | TestRoutingTypeDetection.test_get_routing_type_broadcast |
130 | Test detection of broadcast routing. |
| method | TestRoutingTypeDetection.test_get_routing_type_multicast |
136 | Test detection of multicast routing. |
| method | TestRoutingTypeDetection.test_get_routing_type_topic |
141 | Test detection of topic routing. |
| method | TestRoutingTypeDetection.test_get_routing_type_empty_recipient_error |
148 | Test that empty recipient raises RoutingError. |
| class | TestDirectRouting |
159 | Test direct routing to specific agents. |
| method | TestDirectRouting.test_direct_routing_to_registered_agent |
162 | Test direct routing to a registered agent. |
| method | TestDirectRouting.test_direct_routing_orchestrator_to_postman |
172 | Test orchestrator sending to postman. |
| method | TestDirectRouting.test_direct_routing_to_all_registered_agents |
182 | Test direct routing to each registered agent. |
| method | TestDirectRouting.test_direct_routing_to_unregistered_agent_error |
193 | Test that routing to unregistered agent raises NoRouteFoundError. |
| method | TestDirectRouting.test_direct_routing_non_orchestrator_sender |
203 | Test direct routing from non-orchestrator sender. |
| class | TestTopicRouting |
219 | Test topic-based routing with subscriptions. |
| method | TestTopicRouting.test_topic_routing_no_subscribers_error |
222 | Test that routing to topic with no subscribers raises error. |
| method | TestTopicRouting.test_topic_routing_single_subscriber |
232 | Test topic routing with single subscriber. |
| method | TestTopicRouting.test_topic_routing_multiple_subscribers |
246 | Test topic routing with multiple subscribers. |
| method | TestTopicRouting.test_topic_routing_pattern_matching |
264 | Test topic routing with wildcard pattern matching. |
| method | TestTopicRouting.test_topic_routing_exact_match |
280 | Test topic routing with exact topic match. |
| method | TestTopicRouting.test_topic_routing_no_pattern_match |
293 | Test that non-matching patterns don't receive messages. |
| class | TestBroadcastRouting |
313 | Test broadcast routing to all agents. |
| method | TestBroadcastRouting.test_broadcast_with_asterisk |
316 | Test broadcast routing using asterisk. |
| method | TestBroadcastRouting.test_broadcast_with_keyword |
328 | Test broadcast routing using 'broadcast' keyword. |
| method | TestBroadcastRouting.test_broadcast_with_all_keyword |
338 | Test broadcast routing using 'all' keyword. |
| method | TestBroadcastRouting.test_broadcast_governance_check |
348 | Test that only orchestrator can broadcast. |
| method | TestBroadcastRouting.test_broadcast_orchestrator_authority |
360 | Test that orchestrator has authority to broadcast. |
| class | TestMulticastRouting |
377 | Test multicast routing to multiple specific agents. |
| method | TestMulticastRouting.test_multicast_two_agents |
380 | Test multicast to two agents. |
| method | TestMulticastRouting.test_multicast_three_agents |
392 | Test multicast to three agents. |
| method | TestMulticastRouting.test_multicast_with_spaces |
405 | Test multicast with spaces after commas. |
| method | TestMulticastRouting.test_multicast_unregistered_agent_error |
418 | Test that multicast with unregistered agent raises error. |
| method | TestMulticastRouting.test_multicast_non_orchestrator_sender |
430 | Test multicast from non-orchestrator sender. |
| class | TestRouteCaching |
446 | Test route caching with TTL. |
| method | TestRouteCaching.test_cache_stores_route |
449 | Test that resolved routes are cached. |
| method | TestRouteCaching.test_cache_returns_cached_route |
467 | Test that cached routes are returned on subsequent calls. |
| method | TestRouteCaching.test_cache_expiration |
489 | Test that cache entries expire after TTL. |
| method | TestRouteCaching.test_cache_different_senders |
513 | Test that cache is keyed by sender and recipient. |
| method | TestRouteCaching.test_cache_topic_routing |
534 | Test that topic routing is cached. |
| method | TestRouteCaching.test_cache_broadcast_routing |
552 | Test that broadcast routing is cached. |
| class | TestCacheInvalidation |
574 | Test cache invalidation functionality. |
| method | TestCacheInvalidation.test_invalidate_all_cache |
577 | Test invalidating entire cache. |
| method | TestCacheInvalidation.test_invalidate_specific_pattern |
593 | Test invalidating cache for specific pattern. |
| method | TestCacheInvalidation.test_invalidate_on_topic_subscribe |
610 | Test that subscribing to topic invalidates related cache. |
| method | TestCacheInvalidation.test_invalidate_on_topic_unsubscribe |
643 | Test that unsubscribing from topic invalidates related cache. |
| class | TestTopicSubscriptionManagement |
673 | Test topic subscription operations. |
| method | TestTopicSubscriptionManagement.test_subscribe_to_topic |
676 | Test subscribing agent to topic. |
| method | TestTopicSubscriptionManagement.test_subscribe_multiple_agents_same_topic |
683 | Test multiple agents subscribing to same topic. |
| method | TestTopicSubscriptionManagement.test_subscribe_same_agent_multiple_topics |
695 | Test same agent subscribing to multiple topics. |
| method | TestTopicSubscriptionManagement.test_subscribe_duplicate_ignored |
705 | Test that duplicate subscriptions are handled (set behavior). |
| method | TestTopicSubscriptionManagement.test_unsubscribe_from_topic |
714 | Test unsubscribing agent from topic. |
| method | TestTopicSubscriptionManagement.test_unsubscribe_cleans_empty_subscriptions |
723 | Test that empty subscription sets are cleaned up. |
| method | TestTopicSubscriptionManagement.test_unsubscribe_nonexistent_returns_false |
737 | Test that unsubscribing from nonexistent subscription returns False. |
| method | TestTopicSubscriptionManagement.test_unsubscribe_wrong_agent_returns_false |
742 | Test unsubscribing wrong agent from topic. |
| class | TestStaticRouteManagement |
757 | Test static route add/remove operations. |
| method | TestStaticRouteManagement.test_add_static_route |
760 | Test adding static route. |
| method | TestStaticRouteManagement.test_add_route_creates_copy |
767 | Test that add_route creates a copy of destinations list. |
| method | TestStaticRouteManagement.test_static_route_used_in_resolution |
778 | Test that static routes are used in topic resolution. |
| method | TestStaticRouteManagement.test_static_route_combined_with_subscriptions |
791 | Test that static routes and subscriptions combine. |
| method | TestStaticRouteManagement.test_remove_route |
810 | Test removing static route. |
| method | TestStaticRouteManagement.test_remove_nonexistent_route_returns_false |
819 | Test that removing nonexistent route returns False. |
| method | TestStaticRouteManagement.test_remove_route_invalidates_cache |
824 | Test that removing route invalidates cache. |
| class | TestGovernanceChecks |
852 | Test governance authorization checks. |
| method | TestGovernanceChecks.test_orchestrator_universal_authority |
855 | Test that orchestrator has authority for all routing. |
| method | TestGovernanceChecks.test_broadcast_requires_orchestrator |
873 | Test that only orchestrator can broadcast. |
| method | TestGovernanceChecks.test_topic_routing_allowed_for_all |
881 | Test that topic routing is generally allowed. |
| method | TestGovernanceChecks.test_multicast_allowed_for_all |
894 | Test that multicast routing is allowed for any agent. |
| method | TestGovernanceChecks.test_direct_to_registered_agent_allowed |
905 | Test that direct routing to registered agents is allowed. |
| method | TestGovernanceChecks.test_direct_to_unregistered_agent_denied |
913 | Test that direct routing to unregistered agents is denied. |
| class | TestErrorHandling |
929 | Test error handling for invalid inputs and edge cases. |
| method | TestErrorHandling.test_empty_recipient_error |
932 | Test that empty recipient raises InvalidEnvelopeError during creation. |
| method | TestErrorHandling.test_governance_failure_raises_routing_error |
949 | Test that governance check failure raises RoutingError. |
| method | TestErrorHandling.test_no_route_found_for_topic |
960 | Test NoRouteFoundError for topic with no subscribers. |
| method | TestErrorHandling.test_no_route_found_for_unregistered_agent |
971 | Test NoRouteFoundError for unregistered agent. |
| method | TestErrorHandling.test_multicast_with_unregistered_agent |
982 | Test multicast with one unregistered agent. |
| class | TestRoutingEngineIntegration |
999 | Integration tests for complex routing scenarios. |
| method | TestRoutingEngineIntegration.test_mixed_routing_workflow |
1002 | Test complete workflow with different routing types. |
| method | TestRoutingEngineIntegration.test_dynamic_subscription_changes |
1029 | Test that subscription changes affect routing immediately. |
| method | TestRoutingEngineIntegration.test_cache_across_multiple_routing_types |
1059 | Test that caching works correctly across different routing types. |
| method | TestRoutingEngineIntegration.test_concurrent_routing_operations |
1076 | Test concurrent routing operations. |
| method | TestRoutingEngineIntegration.test_pattern_matching_priority |
1097 | Test that both exact and pattern matches work together. |
| class | TestRoutingPerformance |
1119 | Test performance characteristics of routing engine. |
| method | TestRoutingPerformance.test_cache_performance_benefit |
1122 | Test that caching provides performance benefit. |
| method | TestRoutingPerformance.test_large_number_of_subscriptions |
1141 | Test routing with many subscriptions. |