Skip to content

Agent KB_tests_p14

grisun0 edited this page Oct 17, 2026 · 18 revisions

Subsystem: tests (page 14 of 17)

Previous: KB_tests_p13.md

tests/test_profiles.py

  • Doc: Tests for runtime install profiles (core.profiles).
  • Layer: testing
  • Language: py
  • Symbols:
    • _Spec (class, line 26) class _Spec
    • test_default_profile_is_full (function, line 31) def test_default_profile_is_full(monkeypatch)
    • test_light_profile_selected (function, line 37) def test_light_profile_selected(monkeypatch)
    • test_profile_value_is_case_insensitive (function, line 43) def test_profile_value_is_case_insensitive(monkeypatch)
    • test_unknown_profile_raises (function, line 48) def test_unknown_profile_raises(monkeypatch)
    • test_full_profile_keeps_every_spec (function, line 54) def test_full_profile_keeps_every_spec(monkeypatch)
    • test_light_profile_skips_analytics_and_ai (function, line 60) def test_light_profile_skips_analytics_and_ai(monkeypatch)
    • _pinned_names (function, line 68) def _pinned_names(path)
    • test_light_lock_is_a_subset_of_full_lock (function, line 79) def test_light_lock_is_a_subset_of_full_lock()
    • test_light_lock_drops_analytics_and_ai (function, line 88) def test_light_lock_drops_analytics_and_ai()
    • __init__ (method, line 27) def __init__(self, import_name)
  • Depends on: core/profiles.py

tests/test_prompt_readline_markers.py

  • Doc: Regression tests for readline marker handling in the Neon Box prompt.
  • Layer: testing
  • Language: py
  • Symbols:
    • test_ansi_escape_gets_fenced (function, line 25) def test_ansi_escape_gets_fenced()
    • test_newline_stays_bare (function, line 35) def test_newline_stays_bare()
    • test_mixed_prompt_fences_only_ansi (function, line 43) def test_mixed_prompt_fences_only_ansi()
    • test_render_prompt_default_has_no_markers (function, line 53) def test_render_prompt_default_has_no_markers()
    • test_render_prompt_readline_mode_fences_ansi_only (function, line 62) def test_render_prompt_readline_mode_fences_ansi_only()
    • test_render_prompt_raw_has_no_markers (function, line 70) def test_render_prompt_raw_has_no_markers()
    • test_strip_readline_markers_restores_raw (function, line 79) def test_strip_readline_markers_restores_raw()
    • test_stripped_prompt_matches_box_shape (function, line 87) def test_stripped_prompt_matches_box_shape()
  • Depends on: cli/banner_config.py

tests/test_prompt_refresh.py

  • Doc: Contract tests for live prompt refresh after a payload change.
  • Layer: testing
  • Language: py
  • Symbols:
    • _command_set_with_fake_shell (function, line 22) def _command_set_with_fake_shell()
    • test_prompt_write_forwards_to_shell (function, line 29) def test_prompt_write_forwards_to_shell()
    • test_prompt_read_after_forward (function, line 37) def test_prompt_read_after_forward()
    • test_unrelated_write_stays_local (function, line 44) def test_unrelated_write_stays_local()
    • test_do_assign_calls_refresh_prompt (function, line 52) def test_do_assign_calls_refresh_prompt()
    • test_shell_defines_refresh_prompt (function, line 59) def test_shell_defines_refresh_prompt()
    • test_render_prompt_includes_rhost (function, line 65) def test_render_prompt_includes_rhost()
    • test_no_bracket_replace_hack (function, line 71) def test_no_bracket_replace_hack()
    • test_rhost_commands_use_refresh_prompt (function, line 78) def test_rhost_commands_use_refresh_prompt()
  • Depends on: cli/banner_config.py, cli/commands/_base.py

tests/test_pwntomate_tools.py

  • Doc: Regression guard for pwntomate tool templates (tools/*.tool).
  • Layer: testing
  • Language: py
  • Symbols:
    • _load_tools (function, line 47) def _load_tools()
    • _render (function, line 57) def _render(template, domain, tunnel)
    • _would_run (function, line 83) def _would_run(template, domain)
    • test_templates_are_valid_json_with_required_keys (function, line 92) def test_templates_are_valid_json_with_required_keys()
    • test_placeholders_match_pwntomate_substitutions (function, line 103) def test_placeholders_match_pwntomate_substitutions()
    • test_rendered_commands_have_no_empty_host (function, line 115) def test_rendered_commands_have_no_empty_host()
    • test_gobuster_templates_use_valid_syntax (function, line 129) def test_gobuster_templates_use_valid_syntax()
    • test_no_hardcoded_always_ssl_flag (function, line 141) def test_no_hardcoded_always_ssl_flag()

tests/test_rea_mcp.py

  • Doc: Tests for the lazyown_rea MCP tool (REA reverse-engineering skill).
  • Layer: testing
  • Language: py
  • Symbols:
    • _stub_mcp_sdk (function, line 21) def _stub_mcp_sdk()
    • _call (function, line 73) def _call(arguments, monkeypatch)
    • test_list_tools_has_rea (function, line 90) def test_list_tools_has_rea()
    • test_unknown_action_rejected (function, line 99) def test_unknown_action_rejected(monkeypatch)
    • test_missing_binary (function, line 105) def test_missing_binary(monkeypatch)
    • test_doctor_argv (function, line 113) def test_doctor_argv(monkeypatch)
    • test_inspect_artifact_argv (function, line 119) def test_inspect_artifact_argv(tmp_path, monkeypatch)
    • test_large_output_survives_compaction (function, line 132) def test_large_output_survives_compaction(tmp_path, monkeypatch)
    • test_analyze_uses_explicit_target (function, line 148) def test_analyze_uses_explicit_target(tmp_path, monkeypatch)
    • test_analyze_missing_target (function, line 155) def test_analyze_missing_target(monkeypatch)
    • test_target_flag_injection_rejected (function, line 168) def test_target_flag_injection_rejected(monkeypatch)
    • test_decompile_needs_valid_address (function, line 174) def test_decompile_needs_valid_address(tmp_path, monkeypatch)
    • test_search_needs_query (function, line 189) def test_search_needs_query(tmp_path, monkeypatch)
    • test_provider_flag_appended (function, line 201) def test_provider_flag_appended(tmp_path, monkeypatch)
    • Tool (class, line 35) class Tool
    • TextContent (class, line 39) class TextContent
    • Server (class, line 46) class Server
    • _fake_run (function, line 78) def _fake_run(argv)
    • _fake_run (function, line 138) def _fake_run(argv)
    • __init__ (method, line 36) def __init__(self)
    • __init__ (method, line 40) def __init__(self)
    • __init__ (method, line 47) def __init__(self)
    • list_tools (method, line 50) def list_tools(self)
    • call_tool (method, line 53) def call_tool(self)
  • Depends on: skills/lazyown_mcp.py

tests/test_reactive_engine_semantic.py

  • Doc: Tests for the semantic context advisor in [modules/reactive_engine.py](https://github.com/grisuno/LazyOwn/blob/2f44e17e04bdafed2bc1a36ee7fe88300d346017/modules/reactive_engine.py).
  • Layer: testing
  • Language: py
  • Symbols:
    • _FakeRAG (class, line 33) class _FakeRAG
    • test_returns_empty_when_rag_unavailable (function, line 46) def test_returns_empty_when_rag_unavailable(monkeypatch)
    • test_returns_empty_when_disabled_via_payload (function, line 55) def test_returns_empty_when_disabled_via_payload()
    • test_emits_priority_five_suggestion (function, line 75) def test_emits_priority_five_suggestion()
    • test_skips_low_score_hits (function, line 99) def test_skips_low_score_hits()
    • test_skips_same_command_and_dedupes (function, line 115) def test_skips_same_command_and_dedupes()
    • test_skips_hits_without_command_prefix (function, line 142) def test_skips_hits_without_command_prefix()
    • test_engine_uses_semantic_advisor_when_supplied (function, line 158) def test_engine_uses_semantic_advisor_when_supplied()
    • test_advisor_swallows_rag_query_errors (function, line 186) def test_advisor_swallows_rag_query_errors()
    • __init__ (method, line 36) def __init__(self, hits, ready)
    • query (method, line 41) def query(self, text, n)
    • _ExplodingRAG (class, line 189) class _ExplodingRAG
    • query (method, line 192) def query(self, text, n)
  • Depends on: modules/reactive_engine.py

tests/test_reactive_hints.py

  • Doc: Tests for cli/reactive_hints.py.
  • Layer: testing
  • Language: py
  • Symbols:
    • _FakeAdvisor (class, line 29) class _FakeAdvisor
    • advisor_with_three_hints (function, line 42) def advisor_with_three_hints()
    • empty_advisor (function, line 53) def empty_advisor()
    • TestFirstToken (class, line 57) class TestFirstToken
    • TestTruncate (class, line 71) class TestTruncate
    • TestExtractLabels (class, line 88) class TestExtractLabels
    • TestRenderInlineHints (class, line 111) class TestRenderInlineHints
    • __init__ (method, line 32) def __init__(self, suggestions)
    • suggest_next (method, line 36) def suggest_next(self, recent_commands, limit)
    • test_extracts_first_word (method, line 58) def test_extracts_first_word(self)
    • test_single_word (method, line 61) def test_single_word(self)
    • test_empty_string (method, line 64) def test_empty_string(self)
    • test_whitespace_only (method, line 67) def test_whitespace_only(self)
    • test_short_string_unchanged (method, line 72) def test_short_string_unchanged(self)
    • test_exact_length_unchanged (method, line 75) def test_exact_length_unchanged(self)
    • test_long_string_truncated (method, line 78) def test_long_string_truncated(self)
    • test_truncation_preserves_start (method, line 83) def test_truncation_preserves_start(self)
    • test_picks_label_over_id (method, line 89) def test_picks_label_over_id(self)
    • test_falls_back_to_id_when_no_label (method, line 93) def test_falls_back_to_id_when_no_label(self)
    • test_skips_empty_entries (method, line 97) def test_skips_empty_entries(self)
    • test_respects_limit (method, line 101) def test_respects_limit(self)
    • test_truncates_long_labels (method, line 105) def test_truncates_long_labels(self)
    • test_disabled_flag_skips_render (method, line 112) def test_disabled_flag_skips_render(self, advisor_with_three_hints)
    • test_skip_command_skips_render (method, line 117) def test_skip_command_skips_render(self, advisor_with_three_hints)
    • test_empty_command_skips_render (method, line 122) def test_empty_command_skips_render(self, advisor_with_three_hints)
    • test_empty_suggestions_skips_render (method, line 127) def test_empty_suggestions_skips_render(self, empty_advisor)
    • test_normal_command_renders_hint (method, line 132) def test_normal_command_renders_hint(self, advisor_with_three_hints)
    • test_advisor_called_with_correct_command (method, line 137) def test_advisor_called_with_correct_command(self, advisor_with_three_hints)
    • test_exception_in_advisor_does_not_propagate (method, line 142) def test_exception_in_advisor_does_not_propagate(self)
    • test_all_skip_commands_are_skipped (method, line 149) def test_all_skip_commands_are_skipped(self, advisor_with_three_hints)
    • test_limit_is_passed_to_advisor (method, line 155) def test_limit_is_passed_to_advisor(self, advisor_with_three_hints)
  • Depends on: cli/reactive_hints.py

tests/test_reactive_hints_expanded.py

  • Doc: Tests for cli.reactive_hints — expanded kill-chain tables.
  • Layer: testing
  • Language: py
  • Symbols:
    • TestKillChainNextExpanded (class, line 13) class TestKillChainNextExpanded
    • TestPhasePriorityExpanded (class, line 71) class TestPhasePriorityExpanded
    • TestProtipsExpanded (class, line 107) class TestProtipsExpanded
    • TestProtipTriggers (class, line 161) class TestProtipTriggers
    • test_auto_pwn_in_lazynmap_followups (method, line 14) def test_auto_pwn_in_lazynmap_followups(self)
    • test_auto_pwn_has_followups (method, line 21) def test_auto_pwn_has_followups(self)
    • test_chain_has_followups (method, line 28) def test_chain_has_followups(self)
    • test_hunt_has_followups (method, line 34) def test_hunt_has_followups(self)
    • test_nuclei_has_followups (method, line 40) def test_nuclei_has_followups(self)
    • test_yara_scan_has_followups (method, line 46) def test_yara_scan_has_followups(self)
    • test_lazynmap_suggests_nuclei (method, line 52) def test_lazynmap_suggests_nuclei(self)
    • test_campaign_has_followups (method, line 58) def test_campaign_has_followups(self)
    • test_collab_has_followups (method, line 64) def test_collab_has_followups(self)
    • test_exploit_includes_automation (method, line 72) def test_exploit_includes_automation(self)
    • test_enum_includes_nuclei (method, line 80) def test_enum_includes_nuclei(self)
    • test_postexp_includes_security (method, line 86) def test_postexp_includes_security(self)
    • test_lateral_includes_collab (method, line 93) def test_lateral_includes_collab(self)
    • test_persist_phase_exists (method, line 99) def test_persist_phase_exists(self)
    • test_tips_include_automation (method, line 108) def test_tips_include_automation(self)
    • test_tips_include_security (method, line 120) def test_tips_include_security(self)
    • test_tips_include_collab (method, line 130) def test_tips_include_collab(self)
    • test_tips_include_discovery (method, line 141) def test_tips_include_discovery(self)
    • test_session_tips_expanded (method, line 149) def test_session_tips_expanded(self)
    • test_os_linux_detection (method, line 162) def test_os_linux_detection(self)
    • test_os_windows_detection (method, line 169) def test_os_windows_detection(self)
    • test_after_trigger (method, line 175) def test_after_trigger(self)
    • test_phase_in_trigger (method, line 181) def test_phase_in_trigger(self)
  • Depends on: cli/protips.py, cli/reactive_hints.py

tests/test_reactive_lateral_data.py

  • Doc: Tests for new reactive engine matchers.
  • Layer: testing
  • Language: py
  • Symbols:
    • TestLateralOpportunityMatcher (class, line 12) class TestLateralOpportunityMatcher
    • TestDataOfInterestMatcher (class, line 61) class TestDataOfInterestMatcher
    • TestReactiveEngineIntegration (class, line 119) class TestReactiveEngineIntegration
    • test_kerberos_ticket (method, line 13) def test_kerberos_ticket(self)
    • test_rdp_session (method, line 19) def test_rdp_session(self)
    • test_smb_admin_share (method, line 24) def test_smb_admin_share(self)
    • test_winrm_access (method, line 29) def test_winrm_access(self)
    • test_ssh_key (method, line 34) def test_ssh_key(self)
    • test_wmi_access (method, line 39) def test_wmi_access(self)
    • test_domain_admin (method, line 44) def test_domain_admin(self)
    • test_no_match (method, line 49) def test_no_match(self)
    • test_confidence (method, line 54) def test_confidence(self)
    • test_pii_email (method, line 62) def test_pii_email(self)
    • test_pii_ssn (method, line 67) def test_pii_ssn(self)
    • test_pii_credit_card (method, line 72) def test_pii_credit_card(self)
    • test_secret_api_key (method, line 77) def test_secret_api_key(self)
    • test_secret_aws_key (method, line 82) def test_secret_aws_key(self)
    • test_secret_private_key (method, line 87) def test_secret_private_key(self)
    • test_file_pattern_env (method, line 92) def test_file_pattern_env(self)
    • test_file_pattern_config (method, line 97) def test_file_pattern_config(self)
    • test_no_match (method, line 102) def test_no_match(self)
    • test_confidence_levels (method, line 107) def test_confidence_levels(self)
    • _make_engine (method, line 120) def _make_engine(self, matchers)
    • test_lateral_signals_produce_decisions (method, line 132) def test_lateral_signals_produce_decisions(self)
    • test_data_signals_produce_decisions (method, line 146) def test_data_signals_produce_decisions(self)
    • test_decisions_sorted_by_priority (method, line 161) def test_decisions_sorted_by_priority(self)
  • Depends on: modules/reactive_engine.py

tests/test_reasoning_stream.py

  • Doc: Tests for cli/reasoning_stream.py.
  • Layer: testing
  • Language: py
  • Symbols:
    • _write_events (function, line 28) def _write_events(path, events)
    • test_read_raw_events_missing_file_returns_empty (function, line 32) def test_read_raw_events_missing_file_returns_empty(tmp_path)
    • test_read_raw_events_skips_malformed_lines (function, line 36) def test_read_raw_events_skips_malformed_lines(tmp_path)
    • test_read_raw_events_honours_limit_tail (function, line 46) def test_read_raw_events_honours_limit_tail(tmp_path)
    • test_event_to_entry_step_start_uses_reason_and_source (function, line 53) def test_event_to_entry_step_start_uses_reason_and_source()
    • test_event_to_entry_step_done_failure_flips_icon_and_style (function, line 75) def test_event_to_entry_step_done_failure_flips_icon_and_style()
    • test_event_to_entry_extracts_reward (function, line 85) def test_event_to_entry_extracts_reward()
    • test_event_to_entry_metrics_skip_renders_success_rate (function, line 95) def test_event_to_entry_metrics_skip_renders_success_rate()
    • test_event_to_entry_unknown_type_falls_back (function, line 105) def test_event_to_entry_unknown_type_falls_back()
    • test_event_to_entry_handles_non_dict_payload (function, line 111) def test_event_to_entry_handles_non_dict_payload()
    • test_format_size_threshold (function, line 117) def test_format_size_threshold()
    • test_truncate_adds_ellipsis (function, line 122) def test_truncate_adds_ellipsis()
    • test_latest_reasoning_end_to_end (function, line 127) def test_latest_reasoning_end_to_end(tmp_path)
  • Depends on: cli/reasoning_stream.py

tests/test_recommendation.py

  • Doc: Behaviour tests for the unified recommendation engine and its signals.
  • Layer: testing
  • Language: py
  • Symbols:
    • _ctx (function, line 36) def _ctx(limit, recent, phase)
    • _StubSignal (class, line 46) class _StubSignal
    • _BoomSignal (class, line 55) class _BoomSignal
    • _engine (function, line 62) def _engine(signals, resolver, weights)
    • TestFusionCore (class, line 70) class TestFusionCore
    • TestAdapters (class, line 158) class TestAdapters
    • TestContextAndFactory (class, line 216) class TestContextAndFactory
    • __init__ (method, line 47) def __init__(self, name, proposals)
    • propose (method, line 51) def propose(self, ctx)
    • propose (method, line 58) def propose(self, ctx)
    • test_single_signal_normalises_to_peak (method, line 71) def test_single_signal_normalises_to_peak(self)
    • test_cross_signal_merge_sums_and_records_provenance (method, line 85) def test_cross_signal_merge_sums_and_records_provenance(self)
    • test_category_prior_boosts_matching_action (method, line 98) def test_category_prior_boosts_matching_action(self)
    • test_uncovered_category_surfaces_as_recommendation (method, line 115) def test_uncovered_category_surfaces_as_recommendation(self)
    • test_covered_category_not_duplicated_as_standalone (method, line 123) def test_covered_category_not_duplicated_as_standalone(self)
    • test_deterministic_ordering_on_score_tie (method, line 131) def test_deterministic_ordering_on_score_tie(self)
    • test_limit_is_honoured (method, line 139) def test_limit_is_honoured(self)
    • test_failing_signal_is_isolated (method, line 147) def test_failing_signal_is_isolated(self)
    • test_zero_weight_signal_contributes_nothing (method, line 152) def test_zero_weight_signal_contributes_nothing(self)
    • test_graph_signal_extracts_label_and_score (method, line 159) def test_graph_signal_extracts_label_and_score(self)
    • test_policy_signal_emits_categories (method, line 167) def test_policy_signal_emits_categories(self)
    • test_recon_signal_maps_items_with_descending_weight (method, line 177) def test_recon_signal_maps_items_with_descending_weight(self)
    • test_killchain_signal_uses_adjacency_then_phase (method, line 196) def test_killchain_signal_uses_adjacency_then_phase(self)
    • test_killchain_signal_filters_already_run (method, line 206) def test_killchain_signal_filters_already_run(self)
    • test_read_recent_commands_orders_and_windows (method, line 217) def test_read_recent_commands_orders_and_windows(self, tmp_path)
    • test_read_recent_commands_missing_file (method, line 226) def test_read_recent_commands_missing_file(self, tmp_path)
    • test_build_context_resolves_target_and_phase (method, line 229) def test_build_context_resolves_target_and_phase(self, tmp_path)
    • test_build_default_engine_always_returns_engine (method, line 234) def test_build_default_engine_always_returns_engine(self, tmp_path)
    • _Advisor (class, line 160) class _Advisor
    • _Policy (class, line 168) class _Policy
    • _Item (class, line 178) class _Item
    • _Plan (class, line 185) class _Plan
    • _builder (function, line 188) def _builder(target, engine, payload)
    • suggest_next (method, line 161) def suggest_next(self, recent_commands, limit)
    • get_recommendations (method, line 169) def get_recommendations(self, target)
    • __init__ (method, line 179) def __init__(self, kind, name, reason)
  • Depends on: cli/recommendation.py, cli/recommendation_signals.py

tests/test_recon_plan.py

  • Doc: Spec coverage for :mod:cli.recon_plan.
  • Layer: testing
  • Language: py
  • Symbols:
    • _seed_addon (function, line 68) def _seed_addon(addons_dir, name, os_value, triggers)
    • _seed_tool (function, line 90) def _seed_tool(tools_dir, name, triggers, command, os_value)
    • _seed_command_index (function, line 110) def _seed_command_index(path)
    • _seed_engine (function, line 130) def _seed_engine(sessions, addons, tools, nmap_xml, history_rows, current_os)
    • BuildReconPlanContractSpec (class, line 149) class BuildReconPlanContractSpec(TestCase)
    • RenderMarkdownSpec (class, line 289) class RenderMarkdownSpec(TestCase)
    • WritePlanSpec (class, line 338) class WritePlanSpec(TestCase)
    • RenderRichSpec (class, line 379) class RenderRichSpec(TestCase)
    • setUp (method, line 152) def setUp(self)
    • tearDown (method, line 176) def tearDown(self)
    • _build (method, line 179) def _build(self, current_os, payload)
    • test_plan_includes_addons_matching_open_service (method, line 193) def test_plan_includes_addons_matching_open_service(self)
    • test_plan_filters_os_incompatible_addons_on_linux (method, line 199) def test_plan_filters_os_incompatible_addons_on_linux(self)
    • test_plan_includes_tools_matching_open_service (method, line 204) def test_plan_includes_tools_matching_open_service(self)
    • test_tool_preview_substitutes_payload_placeholders (method, line 210) def test_tool_preview_substitutes_payload_placeholders(self)
    • test_plan_excludes_already_executed_addons (method, line 216) def test_plan_excludes_already_executed_addons(self)
    • test_plan_includes_phase_priority_command_suggestions (method, line 237) def test_plan_includes_phase_priority_command_suggestions(self)
    • test_plan_skips_command_layer_when_index_missing (method, line 243) def test_plan_skips_command_layer_when_index_missing(self)
    • test_plan_uses_payload_target_when_argument_missing (method, line 259) def test_plan_uses_payload_target_when_argument_missing(self)
    • test_empty_scan_returns_empty_plan (method, line 273) def test_empty_scan_returns_empty_plan(self)
    • _plan_with_items (method, line 292) def _plan_with_items(self)
    • test_markdown_starts_with_target_header (method, line 311) def test_markdown_starts_with_target_header(self)
    • test_markdown_renders_services_table (method, line 315) def test_markdown_renders_services_table(self)
    • test_markdown_renders_command_preview_block (method, line 320) def test_markdown_renders_command_preview_block(self)
    • test_markdown_handles_empty_plan (method, line 325) def test_markdown_handles_empty_plan(self)
    • _plan (method, line 341) def _plan(self, target)
    • test_write_creates_expected_filename (method, line 351) def test_write_creates_expected_filename(self)
    • test_write_sanitises_target_for_filename (method, line 358) def test_write_sanitises_target_for_filename(self)
    • test_write_sets_restrictive_permissions (method, line 364) def test_write_sets_restrictive_permissions(self)
    • test_write_overwrites_existing_plan (method, line 370) def test_write_overwrites_existing_plan(self)
    • _Recorder (class, line 383) class _Recorder
    • test_renders_one_line_per_item (method, line 389) def test_renders_one_line_per_item(self)
    • test_renders_friendly_message_when_empty (method, line 406) def test_renders_friendly_message_when_empty(self)
    • print (method, line 386) def print(self, line)
  • Depends on: cli/exploration.py, cli/recon_plan.py

tests/test_report_banners_endpoints.py

  • Doc: Tests for /report and /banners endpoints error handling.
  • Layer: testing
  • Language: py
  • Symbols:
    • load_banners (function, line 18) def load_banners(path)
    • load_json_file_safe (function, line 38) def load_json_file_safe(path)
    • build_report_context (function, line 55) def build_report_context(report_file, session_file, tools_dir)
    • build_banners_html (function, line 95) def build_banners_html(banners)
    • TestLoadBanners (class, line 125) class TestLoadBanners
    • TestBannersHTML (class, line 184) class TestBannersHTML
    • TestReportContext (class, line 217) class TestReportContext
    • TestLoadJSONFileSafe (class, line 341) class TestLoadJSONFileSafe
    • test_dict_format (method, line 128) def test_dict_format(self, tmp_path)
    • test_empty_dict (method, line 146) def test_empty_dict(self, tmp_path)
    • test_file_not_found (method, line 153) def test_file_not_found(self, tmp_path)
    • test_invalid_json (method, line 157) def test_invalid_json(self, tmp_path)
    • test_empty_file (method, line 163) def test_empty_file(self, tmp_path)
    • test_flat_list_format (method, line 169) def test_flat_list_format(self, tmp_path)
    • test_empty_banners (method, line 187) def test_empty_banners(self)
    • test_missing_keys_does_not_crash (method, line 191) def test_missing_keys_does_not_crash(self)
    • test_valid_data (method, line 204) def test_valid_data(self)
    • test_valid_files (method, line 220) def test_valid_files(self, tmp_path)
    • test_empty_session_file (method, line 236) def test_empty_session_file(self, tmp_path)
    • test_invalid_json_session (method, line 249) def test_invalid_json_session(self, tmp_path)
    • test_missing_session_file (method, line 261) def test_missing_session_file(self, tmp_path)
    • test_missing_body_report (method, line 271) def test_missing_body_report(self, tmp_path)
    • test_invalid_body_report_json (method, line 281) def test_invalid_body_report_json(self, tmp_path)
    • test_session_data_as_list (method, line 293) def test_session_data_as_list(self, tmp_path)
    • test_empty_session_list (method, line 304) def test_empty_session_list(self, tmp_path)
    • test_missing_tools_dir (method, line 316) def test_missing_tools_dir(self, tmp_path)
    • test_invalid_tool_file_does_not_crash (method, line 326) def test_invalid_tool_file_does_not_crash(self, tmp_path)
    • test_valid_json (method, line 344) def test_valid_json(self, tmp_path)
    • test_empty_file (method, line 349) def test_empty_file(self, tmp_path)
    • test_file_not_found (method, line 354) def test_file_not_found(self, tmp_path)
    • test_invalid_json (method, line 357) def test_invalid_json(self, tmp_path)
    • test_list_json (method, line 362) def test_list_json(self, tmp_path)

tests/test_require_guards.py

  • Doc: Single-call requirement guards for CommandSet methods.
  • Layer: testing
  • Language: py
  • Symbols:
    • TestRequireGuards (class, line 21) class TestRequireGuards
    • test_present_valid_values_pass (method, line 22) def test_present_valid_values_pass(self, capsys)
    • test_missing_keys_fail_closed_without_keyerror (method, line 29) def test_missing_keys_fail_closed_without_keyerror(self, capsys)
    • test_invalid_values_rejected (method, line 35) def test_invalid_values_rejected(self, capsys)
    • test_equivalent_to_checkers_on_present_values (method, line 41) def test_equivalent_to_checkers_on_present_values(self, capsys)
  • Depends on: core/validators.py

tests/test_resource_script.py

  • Doc: Tests for modules/resource_script.py — ScriptContext and ResourceScriptEngine.
  • Layer: testing
  • Language: py
  • Symbols:
    • TestResourceScript (class, line 10) class TestResourceScript
    • _execute (method, line 14) def _execute(script)
    • test_set_and_get (method, line 25) def test_set_and_get(self)
    • test_setg_and_get (method, line 31) def test_setg_and_get(self)
    • test_unset_removes_var (method, line 37) def test_unset_removes_var(self)
    • test_var_substitution (method, line 46) def test_var_substitution(self)
    • test_builtin_timestamp (method, line 53) def test_builtin_timestamp(self)
    • test_resolve_unresolved (method, line 60) def test_resolve_unresolved(self)
    • test_eval_condition_equals (method, line 66) def test_eval_condition_equals(self)
    • test_eval_condition_not_equals (method, line 72) def test_eval_condition_not_equals(self)
    • test_eval_condition_regex (method, line 77) def test_eval_condition_regex(self)
    • test_eval_condition_numeric (method, line 83) def test_eval_condition_numeric(self)
    • test_eval_condition_contains (method, line 91) def test_eval_condition_contains(self)
    • test_eval_condition_defined (method, line 97) def test_eval_condition_defined(self)
    • test_eval_condition_fallback_falsy (method, line 104) def test_eval_condition_fallback_falsy(self)
    • test_eval_condition_fallback_truthy (method, line 110) def test_eval_condition_fallback_truthy(self)
    • test_dry_run_mode (method, line 116) def test_dry_run_mode(self)
    • test_skip_depth (method, line 125) def test_skip_depth(self)
    • test_if_else_endif_true (method, line 143) def test_if_else_endif_true(self)
    • test_if_else_endif_false (method, line 153) def test_if_else_endif_false(self)
    • test_set_and_echo (method, line 163) def test_set_and_echo(self)
    • test_for_loop (method, line 170) def test_for_loop(self)
    • test_for_loop_empty (method, line 178) def test_for_loop_empty(self)
    • test_while_loop (method, line 187) def test_while_loop(self)
    • test_break (method, line 197) def test_break(self)
    • test_continue (method, line 208) def test_continue(self)
    • test_comment (method, line 219) def test_comment(self)
    • test_macro_and_call (method, line 228) def test_macro_and_call(self)
    • test_spool (method, line 238) def test_spool(self, tmp_path)
    • test_undefined_macro_raises (method, line 253) def test_undefined_macro_raises(self)
    • test_unset_variable (method, line 258) def test_unset_variable(self)
    • test_nested_if (method, line 267) def test_nested_if(self)
  • Depends on: modules/resource_script.py

tests/test_safe_console.py

  • Doc: Terminal-safe console: colors and glyphs degrade, never leak.
  • Layer: testing
  • Language: py
  • Symbols:
    • test_glyphs_degrade_to_ascii (function, line 20) def test_glyphs_degrade_to_ascii(monkeypatch)
    • test_glyphs_unicode_on_utf8 (function, line 32) def test_glyphs_unicode_on_utf8(monkeypatch, capsys)
    • test_console_never_forces_color (function, line 41) def test_console_never_forces_color()
    • test_panel_box_ascii_fallback (function, line 52) def test_panel_box_ascii_fallback(monkeypatch)
  • Depends on: core/safe_console.py

tests/test_safe_subprocess.py

  • Doc: TDD tests for the safe subprocess runner contract.
  • Layer: testing
  • Language: py
  • Symbols:
    • TestRunArgv (class, line 35) class TestRunArgv
    • TestRunShellDefaultDeny (class, line 53) class TestRunShellDefaultDeny
    • TestRunShellAllowed (class, line 71) class TestRunShellAllowed
    • test_run_returns_completed_result (method, line 38) def test_run_returns_completed_result(self)
    • test_run_does_not_audit (method, line 46) def test_run_does_not_audit(self, tmp_path)
    • test_default_deny_raises (method, line 56) def test_default_deny_raises(self)
    • test_deny_audit_logged (method, line 61) def test_deny_audit_logged(self, tmp_path)
    • test_allowed_executes (method, line 74) def test_allowed_executes(self)
    • test_allowed_is_audited (method, line 84) def test_allowed_is_audited(self, tmp_path)
    • test_empty_reason_rejected (method, line 94) def test_empty_reason_rejected(self)
    • test_failed_command_returns_nonzero (method, line 99) def test_failed_command_returns_nonzero(self)
  • Depends on: core/safe_subprocess.py

tests/test_safe_subprocess_behavior.py

  • Doc: BDD behavior scenarios for the safe subprocess contract.
  • Layer: testing
  • Language: py
  • Symbols:
    • test_given_argv_when_run_then_executes_without_audit (function, line 12) def test_given_argv_when_run_then_executes_without_audit(tmp_path)
    • test_given_shell_without_allow_when_called_then_denied (function, line 22) def test_given_shell_without_allow_when_called_then_denied(tmp_path)
    • test_given_shell_with_allow_and_reason_when_called_then_executes (function, line 36) def test_given_shell_with_allow_and_reason_when_called_then_executes(tmp_path)
  • Depends on: core/safe_subprocess.py

tests/test_safety_gates.py

  • Doc: BDD scoped tests for safety gates C01-C03.
  • Layer: testing
  • Language: py
  • Symbols:
    • test_c01_builtin_rules_block_destructive (function, line 10) def test_c01_builtin_rules_block_destructive()
    • test_c01_allow_passthrough_and_audit (function, line 19) def test_c01_allow_passthrough_and_audit()
    • test_c01_deny_rule_and_expiry (function, line 29) def test_c01_deny_rule_and_expiry()
    • test_c01_daemon_gate_blocks_denied_command (function, line 44) def test_c01_daemon_gate_blocks_denied_command()
    • test_c02_record_query_roundtrip (function, line 54) def test_c02_record_query_roundtrip(tmp_path)
    • test_c02_path_traversal_blocked (function, line 67) def test_c02_path_traversal_blocked(tmp_path)
    • test_c03_put_get_and_gc (function, line 78) def test_c03_put_get_and_gc(tmp_path)
    • test_c03_tamper_detected (function, line 100) def test_c03_tamper_detected(tmp_path)
  • Depends on: modules/__init__.py, modules/evidence.py, modules/intercept.py, modules/traffic_recorder.py

Next: KB_tests_p15.md

Start

Wiki

Agent Docs

Recipes

Clone this wiki locally