Orchestrata Ultimate › Tests › Reference › scripts › test_ask_openrouter

Tests reference — tests/scripts/test_ask_openrouter.py

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

Prose pending.

tests/scripts/test_ask_openrouter.py

source · 47 tests · 623 lines

Tests for scripts/ask_openrouter.py — the Claude-invokable OpenRouter CLI.

Kind Name Line Description
function test_resolve_api_key_from_env_takes_precedence 72
function test_resolve_api_key_falls_back_to_dotenv 80
function test_resolve_api_key_missing_returns_empty_string 87
function test_default_dotenv_loader_returns_a_mapping 92
function test_fallback_parse_dotenv_reads_given_paths 98
function test_fallback_parse_dotenv_skips_missing_paths 109
function test_redact_context_strips_secret_and_bearer_lines 119
function test_redact_context_case_insensitive_api_key_password_token 127
function test_redact_context_no_matches_is_unchanged 135
function test_redact_context_bearer_requires_trailing_whitespace 142
function test_validate_context_path_refuses_dotenv 156
function test_validate_context_path_refuses_dotenv_variant 161
function test_validate_context_path_refuses_dot_git 166
function test_validate_context_path_allows_normal_file 171
function test_assemble_context_redacts_and_reports_files 180
function test_assemble_context_refuses_env_file 197
function test_assemble_context_truncates_and_annotates 204
function test_assemble_context_inline_only 216
function test_build_messages_without_system_or_context 227
function test_build_messages_with_system_and_context 234
function test_resolve_prompt_arg_wins_over_stdin 248
function test_resolve_prompt_reads_stdin_when_piped 252
function test_resolve_prompt_none_when_tty_and_no_arg 258
function test_resolve_prompt_none_when_listing_models 262
function test_resolve_prompt_blank_stdin_is_none 266
function test_parse_models_extracts_id_context_pricing 275
function test_parse_models_handles_missing_data_key 284
function test_filter_free_models_keeps_free_suffix_and_zero_pricing 288
function test_filter_free_models_ignores_non_numeric_pricing 297
function test_format_models_table_includes_header_and_rows 311
function test_run_completion_with_injected_async_callable 324
function test_run_completion_uses_adapter_complete_attribute 342
function test_default_complete_call_builds_adapter_with_key 360
function test_iter_sse_chunks_parses_deltas_and_stops_at_done 372
function test_iter_sse_chunks_ignores_non_data_and_malformed_lines 383
function test_build_audit_entry_hashes_prompt_and_omits_text 399
function test_append_audit_log_writes_jsonl 415
function test_default_audit_log_path_is_under_dot_orchestrata 425
function test_run_cli_missing_key_returns_1 457
function test_run_cli_list_models_prints_table 466
function test_run_cli_list_models_free_filters 479
function test_run_cli_requires_model 495
function test_run_cli_requires_prompt 502
function test_run_cli_refuses_env_context_file 511
function test_run_cli_success_with_context_redacts_and_logs_audit 526
function test_run_cli_json_output 577
function test_run_cli_stream_prints_chunks_and_logs_audit 602