Orchestrata Ultimate › Tests › Reference › postman › test_config_extended
Tests reference — tests/postman/test_config_extended.py
Module of tests/postman, split out because the directory page would be too large.
Prose pending.
tests/postman/test_config_extended.py
source · 68 tests · 962 lines
Extended tests for PostmanConfigManager.
Covers: postman.config, postman.exceptions, postman.types
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestInitAndLoad |
62 | Test PostmanConfigManager initialization and load() behavior. |
| method | TestInitAndLoad.test_init_no_args_loads_defaults |
65 | Manager initialized without config_path loads default values. |
| method | TestInitAndLoad.test_init_with_config_path_loads_yaml |
81 | Manager loads configuration from a valid YAML file. |
| method | TestInitAndLoad.test_init_nonexistent_config_file_uses_defaults |
118 | Manager with nonexistent config_path falls back to defaults. |
| method | TestInitAndLoad.test_load_empty_yaml_file_uses_defaults |
126 | Empty YAML file results in default config values. |
| method | TestInitAndLoad.test_load_yaml_with_partial_fields |
138 | YAML with only some fields leaves others at defaults. |
| method | TestInitAndLoad.test_load_yaml_with_only_retry_policy |
154 | YAML containing only retry_policy replaces the entire dict. |
| method | TestInitAndLoad.test_load_raises_on_malformed_yaml |
174 | Malformed YAML raises InvalidConfigError. |
| method | TestInitAndLoad.test_load_raises_when_yaml_unavailable |
182 | If YAML_AVAILABLE is False and a config file exists, raise InvalidConfigError. |
| method | TestInitAndLoad.test_load_raises_on_validation_failure |
201 | YAML config with invalid values raises InvalidConfigError. |
| method | TestInitAndLoad.test_load_raises_on_invalid_retry_policy_type |
209 | YAML with retry_policy as a non-dict raises InvalidConfigError. |
| class | TestDefaultValueHandling |
223 | Test that defaults are correctly applied in various scenarios. |
| method | TestDefaultValueHandling.test_default_retry_policy_is_independent |
226 | Each PostmanConfig instance has its own retry_policy dict. |
| method | TestDefaultValueHandling.test_dict_to_config_fills_all_missing_fields |
237 | _dict_to_config supplies defaults for any missing field. |
| method | TestDefaultValueHandling.test_dict_to_config_with_empty_dict |
249 | _dict_to_config with empty dict returns all defaults. |
| method | TestDefaultValueHandling.test_dict_to_config_with_none_retry_policy |
258 | None retry_policy is replaced with defaults. |
| method | TestDefaultValueHandling.test_dict_to_config_filters_extra_keys |
266 | Unknown keys in config dict are silently ignored. |
| class | TestEnvironmentVariableResolution |
282 | Test env var parsing and application. Uses subprocess for integration. |
| method | TestEnvironmentVariableResolution.test_convert_env_value_int |
285 | _convert_env_value parses integers. |
| method | TestEnvironmentVariableResolution.test_convert_env_value_float |
290 | _convert_env_value parses floats. |
| method | TestEnvironmentVariableResolution.test_convert_env_value_bool_true |
295 | _convert_env_value parses 'true' to True. |
| method | TestEnvironmentVariableResolution.test_convert_env_value_bool_false |
301 | _convert_env_value parses 'false' to False. |
| method | TestEnvironmentVariableResolution.test_convert_env_value_string |
307 | Non-numeric, non-boolean strings are preserved. |
| method | TestEnvironmentVariableResolution.test_convert_env_value_int_then_float_fallback |
312 | Values like '3.0' are parsed as float, not int. |
| method | TestEnvironmentVariableResolution.test_apply_env_overrides_no_matching_vars |
318 | _apply_env_overrides leaves dict unchanged when no vars match. |
| method | TestEnvironmentVariableResolution.test_env_var_override_port_via_subprocess |
325 | POSTMAN_PORT overrides the default port in a subprocess. |
| method | TestEnvironmentVariableResolution.test_env_var_override_nested_retry_policy_via_subprocess |
342 | Double-underscore env vars set nested retry_policy values. |
| method | TestEnvironmentVariableResolution.test_env_var_override_multiple_types_via_subprocess |
364 | Env vars of different types are converted correctly. |
| class | TestValidation |
391 | Test the validate() method thoroughly. |
| method | TestValidation.test_validate_all_fields_valid |
394 | validate returns True for a fully valid config dict. |
| method | TestValidation.test_validate_port_zero |
409 | Port 0 is invalid. |
| method | TestValidation.test_validate_port_negative |
416 | Negative port is invalid. |
| method | TestValidation.test_validate_port_too_high |
423 | Port above 65535 is invalid. |
| method | TestValidation.test_validate_boundary_port_1 |
430 | Port 1 is valid (boundary). |
| method | TestValidation.test_validate_boundary_port_65535 |
436 | Port 65535 is valid (boundary). |
| method | TestValidation.test_validate_max_message_size_zero |
442 | max_message_size must be positive. |
| method | TestValidation.test_validate_max_queue_size_negative |
449 | max_queue_size must be positive. |
| method | TestValidation.test_validate_default_ttl_zero |
456 | default_ttl must be positive. |
| method | TestValidation.test_validate_thread_pool_size_negative |
463 | thread_pool_size must be positive. |
| method | TestValidation.test_validate_retry_policy_not_dict |
470 | retry_policy must be a dict. |
| method | TestValidation.test_validate_multiple_errors_collected |
477 | All validation errors are collected and returned. |
| method | TestValidation.test_validate_empty_dict |
492 | Empty dict has no invalid values, so validate returns True. |
| method | TestValidation.test_validate_none_values_ignored |
499 | None values are not validated (only checked for not-None). |
| class | TestConfigSerialization |
521 | Test serialization of PostmanConfig. |
| method | TestConfigSerialization.test_config_to_dict_returns_all_fields |
524 | to_dict includes every field from PostmanConfig. |
| method | TestConfigSerialization.test_config_to_dict_roundtrip |
540 | to_dict output can be used to recreate an equivalent config. |
| method | TestConfigSerialization.test_config_to_dict_types |
560 | to_dict returns correct Python types. |
| class | TestGetMethod |
579 | Test dot-notation get() method. |
| method | TestGetMethod.test_get_existing_key |
582 | get returns the value for an existing top-level key. |
| method | TestGetMethod.test_get_missing_key_returns_default |
587 | get returns the provided default for a missing key. |
| method | TestGetMethod.test_get_missing_key_no_default_returns_none |
592 | get returns None when key is missing and no default given. |
| method | TestGetMethod.test_get_nested_dict_attribute_not_supported |
597 | Dot notation does not traverse dict keys (only object attributes). |
| method | TestGetMethod.test_get_triggers_load_when_config_is_none |
603 | get calls load() internally when _config is None. |
| class | TestReload |
619 | Test reload() behavior. |
| method | TestReload.test_reload_success |
622 | reload returns (True, None) when config is valid. |
| method | TestReload.test_reload_failure_returns_false_and_error |
640 | reload returns (False, error) when config becomes invalid. |
| method | TestReload.test_reload_skips_callbacks_when_no_prior_config |
655 | No callbacks fired when old_config is None. |
| method | TestReload.test_reload_triggers_callbacks_on_changes |
672 | Callbacks are invoked for each changed field after reload. |
| class | TestCallbacks |
701 | Test on_change and _notify_callbacks. |
| method | TestCallbacks.test_on_change_registers_multiple_callbacks |
704 | Multiple callbacks can be registered. |
| method | TestCallbacks.test_notify_callbacks_only_for_changed_fields |
727 | Callbacks are only invoked for fields that actually changed. |
| method | TestCallbacks.test_notify_callbacks_exception_in_callback_is_handled |
743 | A failing callback does not prevent other callbacks from running. |
| method | TestCallbacks.test_notify_callbacks_no_callbacks_registered |
764 | Notification with no callbacks registered is a no-op. |
| class | TestFileWatching |
778 | Test background file watch thread. |
| method | TestFileWatching.test_watch_for_changes_starts_thread |
781 | watch_for_changes=True creates a daemon thread. |
| method | TestFileWatching.test_start_watch_without_config_path_does_nothing |
798 | _start_watch returns early when no config_path is set. |
| method | TestFileWatching.test_stop_watch_when_no_thread |
803 | stop_watch is safe to call when there is no watch thread. |
| method | TestFileWatching.test_stop_watch_stops_thread |
813 | stop_watch signals the watch thread to exit. |
| method | TestFileWatching.test_watch_loop_detects_file_change |
832 | The watch loop detects mtime changes and reloads config. |
| method | TestFileWatching.test_watch_loop_handles_missing_file |
862 | Watch loop logs debug and continues when the file disappears. |
| method | TestFileWatching.test_watch_loop_continues_when_config_path_none |
885 | Setting _config_path to None at runtime causes the loop to continue. |
| class | TestErrorHandling |
912 | Test explicit error handling and edge cases. |
| method | TestErrorHandling.test_dict_to_config_retry_policy_not_dict_raises |
915 | _dict_to_config raises ValueError when retry_policy is not a dict. |
| method | TestErrorHandling.test_load_wraps_dict_to_config_error |
921 | load() wraps ValueError from _dict_to_config in InvalidConfigError. |
| method | TestErrorHandling.test_load_wraps_yaml_error |
929 | load() wraps yaml.YAMLError in InvalidConfigError. |
| method | TestErrorHandling.test_reload_catches_exception_and_returns_tuple |
937 | reload() catches exceptions and returns (False, str(e)). |
| method | TestErrorHandling.test_custom_env_prefix |
950 | Manager respects a custom env_prefix. |
| method | TestErrorHandling.test_lock_ensures_thread_safety |
958 | The internal RLock is held during load and get operations. |