Agent KB_tests_p7 - grisuno/LazyOwn GitHub Wiki

Subsystem: tests (page 7 of 17)

Previous: KB_tests_p6.md

tests/test_detection_feed.py

  • Doc: Tests for modules/detection_feed.py.
  • Layer: testing
  • Language: py
  • Symbols:
    • TestDetectionFeedInit (class, line 14) class TestDetectionFeedInit
    • TestSigmaParsing (class, line 27) class TestSigmaParsing
    • TestCaching (class, line 68) class TestCaching
    • TestFeedbackAdjustment (class, line 96) class TestFeedbackAdjustment
    • TestCategoryMap (class, line 119) class TestCategoryMap
    • test_default_init (method, line 15) def test_default_init(self, tmp_path)
    • test_custom_sources (method, line 20) def test_custom_sources(self, tmp_path)
    • test_extract_log_source (method, line 28) def test_extract_log_source(self, tmp_path)
    • test_extract_log_source_minimal (method, line 33) def test_extract_log_source_minimal(self, tmp_path)
    • test_extract_mitre (method, line 38) def test_extract_mitre(self, tmp_path)
    • test_extract_mitre_none (method, line 43) def test_extract_mitre_none(self, tmp_path)
    • test_extract_keywords (method, line 48) def test_extract_keywords(self, tmp_path)
    • test_extract_categories (method, line 61) def test_extract_categories(self, tmp_path)
    • test_cache_and_load (method, line 69) def test_cache_and_load(self, tmp_path)
    • test_load_cached_missing (method, line 90) def test_load_cached_missing(self, tmp_path)
    • test_adjust_from_feedback_no_file (method, line 97) def test_adjust_from_feedback_no_file(self, tmp_path)
    • test_adjust_from_feedback (method, line 102) def test_adjust_from_feedback(self, tmp_path)
    • test_category_mappings (method, line 120) def test_category_mappings(self)
    • test_default_probability (method, line 127) def test_default_probability(self)
  • Depends on: modules/detection_feed.py, modules/detection_oracle.py

tests/test_docs_drift_contract.py

  • Doc: Docs drift workflow contract tests.
  • Layer: testing
  • Language: py
  • Symbols:
    • workflow_text (function, line 22) def workflow_text()
    • workflow_steps (function, line 27) def workflow_steps(workflow_text)
    • _runs_command (function, line 38) def _runs_command(step, command)
    • test_workflow_exists (function, line 43) def test_workflow_exists()
    • test_regenerates_command_index (function, line 47) def test_regenerates_command_index(workflow_steps)
    • test_regenerates_commands_reference (function, line 53) def test_regenerates_commands_reference(workflow_steps)
    • test_regenerates_utils_reference (function, line 59) def test_regenerates_utils_reference(workflow_steps)
    • test_diffs_command_index (function, line 65) def test_diffs_command_index(workflow_steps)
    • test_diffs_commands_reference (function, line 71) def test_diffs_commands_reference(workflow_steps)
    • test_diffs_utils_reference (function, line 77) def test_diffs_utils_reference(workflow_steps)
    • test_trigger_watches_generator_inputs (function, line 81) def test_trigger_watches_generator_inputs(workflow_text)

tests/test_doctor.py

  • Doc: tests/test_doctor.py Tests for the preflight environment health check in cli.doctor.
  • Layer: testing
  • Language: py
  • Symbols:
    • TestPythonVersion (class, line 32) class TestPythonVersion
    • TestVirtualEnv (class, line 51) class TestVirtualEnv
    • TestPackages (class, line 72) class TestPackages
    • TestFileChecks (class, line 107) class TestFileChecks
    • TestSecListsAndTools (class, line 129) class TestSecListsAndTools
    • TestReportAggregation (class, line 155) class TestReportAggregation
    • TestGatherAndRun (class, line 184) class TestGatherAndRun
    • test_supported_version_is_ok (method, line 33) def test_supported_version_is_ok(self)
    • test_exact_minimum_is_ok (method, line 37) def test_exact_minimum_is_ok(self)
    • test_old_version_fails (method, line 41) def test_old_version_fails(self)
    • test_uses_live_interpreter_by_default (method, line 46) def test_uses_live_interpreter_by_default(self)
    • test_active_venv_is_ok (method, line 52) def test_active_venv_is_ok(self, tmp_path)
    • test_inactive_with_env_dir_warns_to_activate (method, line 56) def test_inactive_with_env_dir_warns_to_activate(self, tmp_path)
    • test_no_venv_anywhere_warns_to_install (method, line 62) def test_no_venv_anywhere_warns_to_install(self, tmp_path)
    • test_none_base_prefix_collapses_to_prefix (method, line 67) def test_none_base_prefix_collapses_to_prefix(self, tmp_path)
    • test_present_required_package_is_ok (method, line 73) def test_present_required_package_is_ok(self)
    • test_missing_required_package_fails (method, line 78) def test_missing_required_package_fails(self)
    • test_missing_optional_package_warns (method, line 84) def test_missing_optional_package_warns(self)
    • test_finder_exception_treated_as_missing (method, line 89) def test_finder_exception_treated_as_missing(self)
    • test_default_registry_has_core_packages (method, line 97) def test_default_registry_has_core_packages(self)
    • test_import_name_differs_from_pip_name_where_expected (method, line 101) def test_import_name_differs_from_pip_name_where_expected(self)
    • test_payload_present_is_ok (method, line 108) def test_payload_present_is_ok(self, tmp_path)
    • test_payload_missing_fails (method, line 112) def test_payload_missing_fails(self, tmp_path)
    • test_certificates_present_is_ok (method, line 117) def test_certificates_present_is_ok(self, tmp_path)
    • test_certificates_partial_warns (method, line 122) def test_certificates_partial_warns(self, tmp_path)
    • test_seclists_found_is_ok (method, line 130) def test_seclists_found_is_ok(self)
    • test_seclists_missing_warns (method, line 135) def test_seclists_missing_warns(self)
    • test_external_tools_present_and_missing (method, line 139) def test_external_tools_present_and_missing(self)
    • test_overall_status_ok_when_all_ok (method, line 156) def test_overall_status_ok_when_all_ok(self)
    • test_overall_status_warn_with_warnings_only (method, line 161) def test_overall_status_warn_with_warnings_only(self)
    • test_overall_status_fail_trips_healthy (method, line 171) def test_overall_status_fail_trips_healthy(self)
    • test_gather_report_populates_all_sections (method, line 185) def test_gather_report_populates_all_sections(self, tmp_path)
    • test_run_returns_report_without_raising (method, line 194) def test_run_returns_report_without_raising(self, tmp_path)
    • boom (function, line 90) def boom(name)
  • Depends on: cli/__init__.py, cli/wizard.py

tests/test_encoding_command_set.py

  • Doc: Encoding command set extraction tests.
  • Layer: testing
  • Language: py
  • Symbols:
    • _add_repo_root_to_syspath (function, line 28) def _add_repo_root_to_syspath()
    • EncodingSuiteConfig (class, line 34) class EncodingSuiteConfig
    • _methods_of (function, line 59) def _methods_of(path, class_name)
    • test_target_is_active_command_set (function, line 71) def test_target_is_active_command_set()
    • test_target_exposes_full_encoding_cluster (function, line 80) def test_target_exposes_full_encoding_cluster()
    • test_target_phase_metadata (function, line 87) def test_target_phase_metadata()
    • test_source_no_longer_defines_cluster (function, line 93) def test_source_no_longer_defines_cluster()
    • test_registry_registers_target (function, line 99) def test_registry_registers_target()
    • test_no_command_collisions_with_source (function, line 106) def test_no_command_collisions_with_source()
  • Depends on: cli/commands/_base.py, cli/commands/_dormancy.py, cli/commands/encoding.py, cli/commands/misc_migrated.py, cli/registry.py

tests/test_engage_gates.py

  • Doc: BDD tests for gates and transcripts in the live engage path.
  • Layer: testing
  • Language: py
  • Symbols:
    • _ScriptedRunner (class, line 23) class _ScriptedRunner
    • _RecorderNarrator (class, line 44) class _RecorderNarrator
    • _approved_gate (function, line 56) def _approved_gate()
    • temp_sessions (function, line 63) def temp_sessions(tmp_path, monkeypatch)
    • _orch (function, line 74) def _orch(target, scripted, plan, guard)
    • test_denied_command_never_executes (function, line 89) def test_denied_command_never_executes(temp_sessions)
    • test_duplicate_success_is_skipped (function, line 109) def test_duplicate_success_is_skipped(temp_sessions)
    • test_scan_step_skipped_when_scan_held (function, line 123) def test_scan_step_skipped_when_scan_held(temp_sessions)
    • test_executed_steps_leave_transcript_and_evidence (function, line 138) def test_executed_steps_leave_transcript_and_evidence(temp_sessions)
    • test_notify_journal_written_for_findings (function, line 153) def test_notify_journal_written_for_findings(temp_sessions)
    • test_no_new_direction_when_world_unchanged (function, line 164) def test_no_new_direction_when_world_unchanged(temp_sessions, monkeypatch)
    • test_planner_intent_executes_mapped_verb (function, line 175) def test_planner_intent_executes_mapped_verb(temp_sessions, monkeypatch)
    • test_planner_fallback_pushes_forward (function, line 196) def test_planner_fallback_pushes_forward(temp_sessions, monkeypatch)
    • test_latest_hint_renders_newest_event (function, line 225) def test_latest_hint_renders_newest_event(tmp_path)
    • test_engage_summary_counts_ran_and_skipped (function, line 241) def test_engage_summary_counts_ran_and_skipped(temp_sessions, monkeypatch)
    • __init__ (method, line 26) def __init__(self, scripted)
    • run (method, line 31) def run(self, command, timeout)
    • name (method, line 39) def name(self)
    • __init__ (method, line 47) def __init__(self)
    • narrate (method, line 51) def narrate(self, kind)
    • _Dispatcher (class, line 182) class _Dispatcher
    • _EmptyPlanner (class, line 203) class _EmptyPlanner
    • _Dispatcher (class, line 209) class _Dispatcher
    • _Narrator (class, line 248) class _Narrator(_RecorderNarrator)
    • suggest (method, line 183) def suggest(self)
    • plan (method, line 204) def plan(self, target, max_candidates)
    • suggest (method, line 210) def suggest(self)
    • narrate (method, line 249) def narrate(self, kind, message)
  • Depends on: cli/reasoning_stream.py, modules/intercept.py, modules/planner.py, modules/traffic_recorder.py, skills/autonomous_daemon.py

tests/test_engage_orchestrator.py

  • Doc: tests/test_engage_orchestrator.py Coverage for the engage feature added in...
  • Layer: testing
  • Language: py
  • Symbols:
    • temp_sessions (function, line 47) def temp_sessions(tmp_path, monkeypatch)
    • TestEngagementNarrator (class, line 86) class TestEngagementNarrator
    • TestNotificationBroadcaster (class, line 139) class TestNotificationBroadcaster
    • TestShellObtainedPublisher (class, line 191) class TestShellObtainedPublisher
    • TestIsValidTarget (class, line 241) class TestIsValidTarget
    • policy_module (function, line 270) def policy_module(temp_sessions, monkeypatch)
    • _RecordingSink (class, line 280) class _RecordingSink
    • TestApprovalGate (class, line 294) class TestApprovalGate
    • TestFileApprovalSink (class, line 385) class TestFileApprovalSink
    • TestStdinApprovalSink (class, line 431) class TestStdinApprovalSink
    • TestStaticFallbackResolver (class, line 451) class TestStaticFallbackResolver
    • _ScriptedRunner (class, line 473) class _ScriptedRunner
    • _NoOpGate (class, line 497) class _NoOpGate
    • _RejectingGate (class, line 508) class _RejectingGate
    • TestEngageOrchestrator (class, line 528) class TestEngageOrchestrator
    • TestMcpEntryPoints (class, line 632) class TestMcpEntryPoints
    • TestWiring (class, line 676) class TestWiring
    • test_narrate_writes_log_and_audit (method, line 87) def test_narrate_writes_log_and_audit(self, temp_sessions)
    • test_stream_sink_appends_to_autonomous_events (method, line 112) def test_stream_sink_appends_to_autonomous_events(self, temp_sessions)
    • test_render_line_format_is_stable (method, line 123) def test_render_line_format_is_stable(self)
    • test_fans_out_to_every_sink (method, line 140) def test_fans_out_to_every_sink(self, temp_sessions)
    • test_failing_sink_does_not_break_broadcaster (method, line 162) def test_failing_sink_does_not_break_broadcaster(self, temp_sessions)
    • test_first_call_emits_event (method, line 192) def test_first_call_emits_event(self, temp_sessions)
    • test_repeat_call_is_idempotent (method, line 209) def test_repeat_call_is_idempotent(self, temp_sessions)
    • test_invalid_client_id_returns_none (method, line 217) def test_invalid_client_id_returns_none(self, temp_sessions)
    • test_client_id_is_sanitised (method, line 223) def test_client_id_is_sanitised(self, temp_sessions)
    • test_accepts_ipv4 (method, line 242) def test_accepts_ipv4(self)
    • test_accepts_hostname (method, line 248) def test_accepts_hostname(self)
    • test_rejects_garbage (method, line 254) def test_rejects_garbage(self)
    • __init__ (method, line 283) def __init__(self)
    • announce (method, line 287) def announce(self, request)
    • resolution_for (method, line 290) def resolution_for(self, approval_id)
    • test_auto_approve_true_returns_approved_for_gated_phase (method, line 295) def test_auto_approve_true_returns_approved_for_gated_phase(self, policy_module, temp_sessions)
    • test_non_gated_phase_bypasses_sink (method, line 310) def test_non_gated_phase_bypasses_sink(self, policy_module, temp_sessions)
    • test_gated_phase_with_auto_approve_false_polls_sink (method, line 326) def test_gated_phase_with_auto_approve_false_polls_sink(self, policy_module, temp_sessions)
    • test_gated_phase_times_out_to_denied (method, line 356) def test_gated_phase_times_out_to_denied(self, policy_module, temp_sessions)
    • test_invalid_payload_defaults_to_auto_approve_true (method, line 375) def test_invalid_payload_defaults_to_auto_approve_true(self, policy_module, temp_sessions)
    • test_announce_writes_pending_record (method, line 386) def test_announce_writes_pending_record(self, policy_module, temp_sessions)
    • test_resolution_returns_latest_non_pending (method, line 402) def test_resolution_returns_latest_non_pending(self, policy_module, temp_sessions)
    • test_no_tty_returns_none (method, line 432) def test_no_tty_returns_none(self, policy_module)
    • test_returns_alternatives_in_order (method, line 452) def test_returns_alternatives_in_order(self)
    • test_unknown_primary_returns_none (method, line 462) def test_unknown_primary_returns_none(self)
    • __init__ (method, line 481) def __init__(self, scripted)
    • run (method, line 485) def run(self, command, timeout)
    • name (method, line 493) def name(self)
    • request (method, line 498) def request(self, target, phase, command, reason)
    • __init__ (method, line 509) def __init__(self, rejected_phase)
    • request (method, line 512) def request(self, target, phase, command, reason)
    • test_rejects_invalid_target (method, line 529) def test_rejects_invalid_target(self, temp_sessions, policy_module)
    • test_runs_full_plan_on_success (method, line 535) def test_runs_full_plan_on_success(self, temp_sessions, policy_module)
    • test_switches_tool_on_failure (method, line 559) def test_switches_tool_on_failure(self, temp_sessions, policy_module)
    • test_denied_step_is_skipped (method, line 585) def test_denied_step_is_skipped(self, temp_sessions, policy_module)
    • test_shell_indicator_stops_loop (method, line 609) def test_shell_indicator_stops_loop(self, temp_sessions, policy_module)
    • test_engage_target_rejects_invalid (method, line 633) def test_engage_target_rejects_invalid(self, temp_sessions, policy_module)
    • test_engage_target_returns_engagement_id (method, line 639) def test_engage_target_returns_engagement_id(self, temp_sessions, policy_module)
    • test_engage_status_returns_pending_approvals_structure (method, line 648) def test_engage_status_returns_pending_approvals_structure(self, temp_sessions, policy_module)
    • test_engage_approve_rejects_bad_decision (method, line 656) def test_engage_approve_rejects_bad_decision(self, temp_sessions, policy_module)
    • test_engage_approve_accepts_valid_decision (method, line 662) def test_engage_approve_accepts_valid_decision(self, temp_sessions, policy_module)
    • test_do_engage_method_exists_in_lazyown (method, line 677) def test_do_engage_method_exists_in_lazyown(self)
    • test_lazyc2_has_engagement_hook_call (method, line 684) def test_lazyc2_has_engagement_hook_call(self)
    • test_mcp_exposes_four_engage_tools (method, line 688) def test_mcp_exposes_four_engage_tools(self)
    • test_daemon_has_engage_subcommand (method, line 698) def test_daemon_has_engage_subcommand(self)
    • test_payload_json_auto_approve_key_is_bool_when_present (method, line 703) def test_payload_json_auto_approve_key_is_bool_when_present(self)
    • test_approval_gate_defaults_to_true_when_key_missing (method, line 708) def test_approval_gate_defaults_to_true_when_key_missing(self, tmp_path)
    • test_engagement_hooks_module_exposes_public_surface (method, line 726) def test_engagement_hooks_module_exposes_public_surface(self)
    • test_policy_module_exposes_approval_surface (method, line 740) def test_policy_module_exposes_approval_surface(self)
    • _CountingSink (class, line 145) class _CountingSink(INotificationSink)
    • _BoomSink (class, line 165) class _BoomSink(INotificationSink)
    • _GoodSink (class, line 173) class _GoodSink(INotificationSink)
    • _injected_sleep (function, line 330) def _injected_sleep(_seconds)
    • __init__ (method, line 146) def __init__(self, name)
    • name (method, line 150) def name(self)
    • deliver (method, line 153) def deliver(self, event)
    • name (method, line 167) def name(self)
    • deliver (method, line 170) def deliver(self, event)
    • name (method, line 175) def name(self)
    • deliver (method, line 178) def deliver(self, event)
  • Depends on: skills/autonomous_daemon.py, skills/lazyown_policy.py

tests/test_engage_summary.py

  • Doc: Tests for modules/engage_summary.py.
  • Layer: testing
  • Language: py
  • Symbols:
    • _step (function, line 45) def _step(command)
    • test_marker_lines_drop_panels_and_bars (function, line 54) def test_marker_lines_drop_panels_and_bars()
    • test_detail_for_ping_extracts_os (function, line 62) def test_detail_for_ping_extracts_os()
    • test_detail_for_populate_extracts_services (function, line 69) def test_detail_for_populate_extracts_services()
    • test_detail_for_empty_search_is_honest (function, line 76) def test_detail_for_empty_search_is_honest()
    • test_held_scan_ports_reads_xml (function, line 82) def test_held_scan_ports_reads_xml(tmp_path)
    • test_render_text_shows_skip_with_held_ports (function, line 91) def test_render_text_shows_skip_with_held_ports(tmp_path)
    • test_full_output_prefers_evidence (function, line 104) def test_full_output_prefers_evidence(tmp_path)
    • test_write_report_persists_markdown (function, line 114) def test_write_report_persists_markdown(tmp_path)
    • test_render_markdown_lists_evidence_and_next (function, line 125) def test_render_markdown_lists_evidence_and_next()
  • Depends on: modules/engage_summary.py, modules/evidence.py

tests/test_engagement_and_ping.py

  • Doc: tests/test_engagement_and_ping.py
  • Layer: testing
  • Language: py
  • Symbols:
    • _command_location (function, line 30) def _command_location(name)
    • TestEngagementState (class, line 58) class TestEngagementState
    • TestVRIScheduler (class, line 105) class TestVRIScheduler
    • TestCuriosityEngine (class, line 177) class TestCuriosityEngine
    • TestPingOsId (class, line 283) class TestPingOsId
    • TestRecommendNextCommandIndex (class, line 351) class TestRecommendNextCommandIndex
    • test_load_fresh_state_has_zero_commands (method, line 59) def test_load_fresh_state_has_zero_commands(self, tmp_path)
    • test_save_and_reload_state (method, line 74) def test_save_and_reload_state(self, tmp_path)
    • test_atomic_write_leaves_no_tmp_file (method, line 90) def test_atomic_write_leaves_no_tmp_file(self, tmp_path)
    • test_next_threshold_always_positive (method, line 106) def test_next_threshold_always_positive(self)
    • test_next_threshold_mean_near_target (method, line 113) def test_next_threshold_mean_near_target(self)
    • test_threshold_is_variable_not_constant (method, line 120) def test_threshold_is_variable_not_constant(self)
    • test_vri_fires_when_threshold_reached (method, line 126) def test_vri_fires_when_threshold_reached(self, tmp_path, capsys)
    • test_vri_does_not_fire_before_threshold (method, line 152) def test_vri_does_not_fire_before_threshold(self, tmp_path, capsys)
    • _make_state (method, line 178) def _make_state(self, seen)
    • _minimal_index (method, line 186) def _minimal_index(self, phase_cmds)
    • test_curiosity_shows_undiscovered_command (method, line 192) def test_curiosity_shows_undiscovered_command(self, capsys)
    • test_curiosity_does_not_repeat_in_session (method, line 202) def test_curiosity_does_not_repeat_in_session(self, capsys)
    • test_curiosity_silent_when_all_discovered (method, line 219) def test_curiosity_silent_when_all_discovered(self, capsys)
    • test_curiosity_silent_when_disabled (method, line 229) def test_curiosity_silent_when_disabled(self, capsys)
    • test_curiosity_silent_for_unknown_phase (method, line 245) def test_curiosity_silent_for_unknown_phase(self, capsys)
    • test_commands_seen_accumulates_across_calls (method, line 254) def test_commands_seen_accumulates_across_calls(self, tmp_path)
    • _ping_stdout (method, line 286) def _ping_stdout(self, ttl)
    • _make_params (method, line 289) def _make_params(self)
    • _extract_os_id_from_json (method, line 292) def _extract_os_id_from_json(self, data)
    • test_ttl_64_maps_to_os_id_1_linux (method, line 295) def test_ttl_64_maps_to_os_id_1_linux(self)
    • test_ttl_128_maps_to_os_id_2_windows (method, line 302) def test_ttl_128_maps_to_os_id_2_windows(self)
    • test_ttl_127_maps_to_os_id_2_windows (method, line 309) def test_ttl_127_maps_to_os_id_2_windows(self)
    • test_ttl_63_maps_to_os_id_1_linux (method, line 316) def test_ttl_63_maps_to_os_id_1_linux(self)
    • test_ttl_255_maps_to_unknown (method, line 323) def test_ttl_255_maps_to_unknown(self)
    • test_ping_os_json_contract (method, line 330) def test_ping_os_json_contract(self)
    • test_ping_persists_via_apply_assign (method, line 338) def test_ping_persists_via_apply_assign(self)
    • _build_index (method, line 354) def _build_index(self, tmp_path, phase, n_cmds)
    • _build_csv (method, line 366) def _build_csv(self, tmp_path, run_cmds)
    • test_shows_unrun_commands (method, line 411) def test_shows_unrun_commands(self, tmp_path, capsys)
    • test_shows_nothing_when_all_run (method, line 436) def test_shows_nothing_when_all_run(self, tmp_path)
    • test_no_graph_nodes_in_output (method, line 456) def test_no_graph_nodes_in_output(self, tmp_path, capsys)
    • test_no_advisor_reference_before_definition (method, line 470) def test_no_advisor_reference_before_definition(self)
    • test_rule_not_used_without_import (method, line 509) def test_rule_not_used_without_import(self)
    • test_fallback_message_present (method, line 517) def test_fallback_message_present(self)
  • Depends on: cli/engagement_hooks.py

tests/test_engagement_command_gate.py

  • Doc: Tests for the command-recording gate of cli/engagement_hooks.py.
  • Layer: testing
  • Language: py
  • Symbols:
    • _redirect_paths (function, line 34) def _redirect_paths(tmp_path)
    • _restore_paths (function, line 56) def _restore_paths(saved)
    • TestIsRecordableCommand (class, line 68) class TestIsRecordableCommand
    • TestHookRejectsNoise (class, line 106) class TestHookRejectsNoise
    • TestSanitizeSeen (class, line 141) class TestSanitizeSeen
    • TestHealCommandsSeen (class, line 187) class TestHealCommandsSeen
    • test_accepts_command_shaped_tokens (method, line 72) def test_accepts_command_shaped_tokens(self, cmd)
    • test_rejects_syntactic_garbage (method, line 81) def test_rejects_syntactic_garbage(self, cmd)
    • test_quoted_path_rejected (method, line 86) def test_quoted_path_rejected(self)
    • test_do_prefixed_input_is_accepted (method, line 91) def test_do_prefixed_input_is_accepted(self)
    • test_normalize_is_idempotent (method, line 96) def test_normalize_is_idempotent(self)
    • test_garbage_does_not_enter_commands_seen (method, line 109) def test_garbage_does_not_enter_commands_seen(self, tmp_path)
    • test_real_command_recorded_between_garbage (method, line 123) def test_real_command_recorded_between_garbage(self, tmp_path)
    • test_syntactic_only_drops_ugly_garbage (method, line 144) def test_syntactic_only_drops_ugly_garbage(self)
    • test_roster_drops_valid_but_unknown_tokens (method, line 158) def test_roster_drops_valid_but_unknown_tokens(self)
    • test_load_state_heals_polluted_file (method, line 165) def test_load_state_heals_polluted_file(self, tmp_path)
    • test_purges_and_persists (method, line 190) def test_purges_and_persists(self, tmp_path)
    • test_idempotent_on_clean_state (method, line 207) def test_idempotent_on_clean_state(self, tmp_path)
  • Depends on: cli/engagement_hooks.py

tests/test_engagement_elo_and_methodology.py

  • Doc: Tests for the ELO + karma + methodology extensions of cli/engagement_hooks.py.
  • Layer: testing
  • Language: py
  • Symbols:
    • _no_cli_operator (function, line 31) def _no_cli_operator(monkeypatch)
    • _redirect_paths (function, line 48) def _redirect_paths(tmp_path)
    • _restore_paths (function, line 76) def _restore_paths(saved)
    • TestGetKarmaName (class, line 88) class TestGetKarmaName
    • TestAwardElo (class, line 119) class TestAwardElo
    • TestSyncUserElo (class, line 179) class TestSyncUserElo
    • TestPersistNotification (class, line 252) class TestPersistNotification
    • TestMethodologyRewards (class, line 313) class TestMethodologyRewards
    • TestKarmaUp (class, line 425) class TestKarmaUp
    • TestRenderEngagementHookIntegration (class, line 463) class TestRenderEngagementHookIntegration
    • TestStateSnapshot (class, line 524) class TestStateSnapshot
    • test_thresholds (method, line 110) def test_thresholds(self, elo, expected)
    • test_base_only_for_unknown_command_and_phase (method, line 120) def test_base_only_for_unknown_command_and_phase(self)
    • test_high_value_bonus_applied (method, line 125) def test_high_value_bonus_applied(self)
    • test_phase_bonus_applied (method, line 131) def test_phase_bonus_applied(self)
    • test_first_time_bonus (method, line 137) def test_first_time_bonus(self)
    • test_new_phase_bonus (method, line 143) def test_new_phase_bonus(self)
    • test_all_bonuses_stack (method, line 149) def test_all_bonuses_stack(self)
    • test_do_prefix_is_stripped (method, line 169) def test_do_prefix_is_stripped(self)
    • test_patches_matching_username (method, line 180) def test_patches_matching_username(self, tmp_path)
    • test_silent_when_payload_missing (method, line 199) def test_silent_when_payload_missing(self, tmp_path)
    • test_silent_when_username_not_found (method, line 211) def test_silent_when_username_not_found(self, tmp_path)
    • test_ignores_non_positive_delta (method, line 224) def test_ignores_non_positive_delta(self, tmp_path)
    • test_atomic_rename_leaves_no_tmp (method, line 234) def test_atomic_rename_leaves_no_tmp(self, tmp_path)
    • test_creates_file_on_first_call (method, line 253) def test_creates_file_on_first_call(self, tmp_path)
    • test_appends_to_existing_file (method, line 264) def test_appends_to_existing_file(self, tmp_path)
    • test_ring_cap_drops_oldest (method, line 277) def test_ring_cap_drops_oldest(self, tmp_path)
    • test_recovers_from_corrupt_file (method, line 297) def test_recovers_from_corrupt_file(self, tmp_path)
    • test_task_reward_silent_when_no_file (method, line 314) def test_task_reward_silent_when_no_file(self, tmp_path, capsys)
    • test_task_reward_renders_pending_match (method, line 324) def test_task_reward_renders_pending_match(self, tmp_path, capsys)
    • test_task_reward_silent_when_all_done (method, line 344) def test_task_reward_silent_when_all_done(self, tmp_path, capsys)
    • test_objective_reward_uses_phase_to_next_cmd (method, line 361) def test_objective_reward_uses_phase_to_next_cmd(self, tmp_path, capsys)
    • test_objective_reward_silent_when_no_pending (method, line 379) def test_objective_reward_silent_when_no_pending(self, tmp_path, capsys)
    • test_note_reward_renders_latest (method, line 391) def test_note_reward_renders_latest(self, tmp_path, capsys)
    • test_note_reward_silent_when_empty (method, line 412) def test_note_reward_silent_when_empty(self, tmp_path, capsys)
    • test_fires_on_threshold_crossing (method, line 426) def test_fires_on_threshold_crossing(self, tmp_path, capsys)
    • test_idempotent_when_no_threshold_cross (method, line 440) def test_idempotent_when_no_threshold_cross(self, capsys)
    • test_persists_notification (method, line 447) def test_persists_notification(self, tmp_path)
    • test_elo_accumulates_across_commands (method, line 464) def test_elo_accumulates_across_commands(self, tmp_path)
    • test_first_time_bonus_only_once_per_command (method, line 479) def test_first_time_bonus_only_once_per_command(self, tmp_path)
    • test_users_json_syncd_when_payload_present (method, line 493) def test_users_json_syncd_when_payload_present(self, tmp_path)
    • test_disabled_flag_is_noop (method, line 508) def test_disabled_flag_is_noop(self, tmp_path, capsys)
    • test_returns_required_keys (method, line 525) def test_returns_required_keys(self, tmp_path)
  • Depends on: cli/engagement_hooks.py, modules/cli_auth.py

tests/test_estorides_fusion.py

  • Doc: Estorides OSINT fusion: load, merge, surface readers.
  • Layer: testing
  • Language: py
  • Symbols:
    • _load_surface_graph (function, line 27) def _load_surface_graph()
    • _base_nodes (function, line 37) def _base_nodes()
    • test_load_lazyown_vocabulary (function, line 45) def test_load_lazyown_vocabulary(tmp_path)
    • test_load_raw_export_translates_types (function, line 58) def test_load_raw_export_translates_types(tmp_path)
    • test_merge_fuses_matching_ip (function, line 75) def test_merge_fuses_matching_ip()
    • test_merge_adds_new_entities_capped (function, line 91) def test_merge_adds_new_entities_capped()
    • test_merge_edges_reanchor (function, line 107) def test_merge_edges_reanchor(tmp_path)
    • test_find_export_prefers_lazyown (function, line 127) def test_find_export_prefers_lazyown(tmp_path)
    • test_parse_confirm (function, line 132) def test_parse_confirm()
    • test_discovery_targets_reads_all_files (function, line 139) def test_discovery_targets_reads_all_files(tmp_path)
    • test_write_world_model_hosts (function, line 146) def test_write_world_model_hosts(tmp_path)
    • test_surface_readers_cover_sessions_formats (function, line 158) def test_surface_readers_cover_sessions_formats(tmp_path)
  • Depends on: modules/estorides_fusion.py, modules/surface_ops.py

tests/test_evidence_hints.py

  • Doc: Tests for evidence-backed inline hints.
  • Layer: testing
  • Language: py
  • Symbols:
    • _rec (function, line 33) def _rec(action, score, reasons, sources, command_preview)
    • _FakeEngine (class, line 50) class _FakeEngine
    • TestConfidenceFromScore (class, line 62) class TestConfidenceFromScore
    • TestBuildEvidenceHints (class, line 86) class TestBuildEvidenceHints
    • TestRenderEvidenceHints (class, line 131) class TestRenderEvidenceHints
    • TestRecommendWithEvidence (class, line 144) class TestRecommendWithEvidence
    • tmp_sessions_with_csv (function, line 162) def tmp_sessions_with_csv()
    • _engine_with_stub (function, line 170) def _engine_with_stub(sessions, recs, evidence)
    • TestTipsEngineEvidenceWiring (class, line 178) class TestTipsEngineEvidenceWiring
    • __init__ (method, line 53) def __init__(self, recs)
    • recommend (method, line 57) def recommend(self, ctx)
    • test_zero_score_is_zero_confidence (method, line 63) def test_zero_score_is_zero_confidence(self)
    • test_negative_score_floored_to_zero (method, line 66) def test_negative_score_floored_to_zero(self)
    • test_half_score_constant_yields_fifty (method, line 69) def test_half_score_constant_yields_fifty(self)
    • test_monotonic_non_decreasing (method, line 72) def test_monotonic_non_decreasing(self)
    • test_never_reaches_or_exceeds_hundred (method, line 76) def test_never_reaches_or_exceeds_hundred(self)
    • test_bounded_in_unit_range_scaled (method, line 80) def test_bounded_in_unit_range_scaled(self)
    • test_maps_core_fields (method, line 87) def test_maps_core_fields(self)
    • test_strips_source_tag_from_reason (method, line 100) def test_strips_source_tag_from_reason(self)
    • test_prefers_command_preview_over_action (method, line 104) def test_prefers_command_preview_over_action(self)
    • test_skips_recommendation_without_verb (method, line 111) def test_skips_recommendation_without_verb(self)
    • test_skips_recommendation_without_reason (method, line 115) def test_skips_recommendation_without_reason(self)
    • test_respects_limit (method, line 119) def test_respects_limit(self)
    • test_truncates_long_reason (method, line 125) def test_truncates_long_reason(self)
    • test_prints_verb_confidence_and_reason (method, line 132) def test_prints_verb_confidence_and_reason(self, capsys)
    • test_empty_list_prints_nothing (method, line 139) def test_empty_list_prints_nothing(self, capsys)
    • test_returns_engine_output (method, line 145) def test_returns_engine_output(self)
    • test_phase_override_reaches_engine_context (method, line 150) def test_phase_override_reaches_engine_context(self)
    • test_target_falls_back_to_rhost (method, line 155) def test_target_falls_back_to_rhost(self)
    • test_disabled_flag_returns_empty (method, line 179) def test_disabled_flag_returns_empty(self, tmp_sessions_with_csv)
    • test_missing_engine_returns_empty (method, line 183) def test_missing_engine_returns_empty(self, tmp_sessions_with_csv)
    • test_returns_evidence_hints (method, line 190) def test_returns_evidence_hints(self, tmp_sessions_with_csv)
    • test_filters_already_run_commands (method, line 196) def test_filters_already_run_commands(self, tmp_sessions_with_csv)
    • test_render_prefers_evidence_over_bare_names (method, line 208) def test_render_prefers_evidence_over_bare_names(self, tmp_sessions_with_csv)
    • test_render_falls_back_to_bare_names (method, line 214) def test_render_falls_back_to_bare_names(self, tmp_sessions_with_csv)
  • Depends on: cli/reactive_hints.py, cli/recommendation_signals.py, cli/tips_engine.py

tests/test_executor_kernel.py

  • Doc: Single execution kernel shared by every command runner.
  • Layer: testing
  • Language: py
  • Symbols:
    • _executor (function, line 29) def _executor()
    • TestColorsPreserved (class, line 33) class TestColorsPreserved
    • TestExitCodes (class, line 62) class TestExitCodes
    • TestShellPolicy (class, line 87) class TestShellPolicy
    • TestSingleSpawnPath (class, line 113) class TestSingleSpawnPath
    • test_writer_receives_raw_ansi_bytes (method, line 34) def test_writer_receives_raw_ansi_bytes(self)
    • test_log_file_is_byte_identical_to_writer (method, line 42) def test_log_file_is_byte_identical_to_writer(self, tmp_path)
    • test_stderr_merged_into_stream (method, line 52) def test_stderr_merged_into_stream(self)
    • test_shell_path_exit_code (method, line 63) def test_shell_path_exit_code(self)
    • test_argv_path_exit_code (method, line 70) def test_argv_path_exit_code(self)
    • test_passthrough_returns_exit_code (method, line 76) def test_passthrough_returns_exit_code(self)
    • test_matches_shared_policy (method, line 101) def test_matches_shared_policy(self)
    • test_timeout_kills_and_raises (method, line 106) def test_timeout_kills_and_raises(self)
    • test_cmd_delegates_spawning_to_kernel (method, line 114) def test_cmd_delegates_spawning_to_kernel(self)
    • test_cmd_keeps_telemetry (method, line 142) def test_cmd_keeps_telemetry(self)
  • Depends on: core/safe_exec.py, modules/command_executor.py

tests/test_exploitgym_gym.py

  • Doc: Tests for the ExploitGym integration module.
  • Layer: testing
  • Language: py
  • Symbols:
    • _add_repo_root_to_syspath (function, line 18) def _add_repo_root_to_syspath()
    • fake_repo (function, line 24) def fake_repo(tmp_path)
    • _params (function, line 39) def _params(root)
    • test_detect_domain_userspace (function, line 51) def test_detect_domain_userspace(fake_repo)
    • test_list_tasks_filters_by_domain (function, line 60) def test_list_tasks_filters_by_domain(fake_repo)
    • test_list_tasks_empty_without_repo (function, line 77) def test_list_tasks_empty_without_repo(tmp_path)
    • test_check_readiness_ready (function, line 84) def test_check_readiness_ready(fake_repo, monkeypatch)
    • test_check_readiness_missing_docker (function, line 99) def test_check_readiness_missing_docker(fake_repo, monkeypatch)
    • test_check_readiness_missing_keys (function, line 115) def test_check_readiness_missing_keys(fake_repo, monkeypatch)
    • test_extract_flag (function, line 129) def test_extract_flag()
    • test_run_task_writes_log_and_records (function, line 137) def test_run_task_writes_log_and_records(fake_repo, tmp_path, monkeypatch)
    • test_run_task_reports_missing_repo (function, line 166) def test_run_task_reports_missing_repo(tmp_path)
    • test_pull_task_success (function, line 174) def test_pull_task_success(fake_repo, monkeypatch)
    • test_score_task_reuses_redteam_pipeline (function, line 192) def test_score_task_reuses_redteam_pipeline(fake_repo, monkeypatch)
    • test_setup_harness_reports_missing_repo (function, line 212) def test_setup_harness_reports_missing_repo(tmp_path, monkeypatch)
    • test_setup_harness_runs_requested_steps (function, line 221) def test_setup_harness_runs_requested_steps(fake_repo, monkeypatch)
    • test_command_set_declares_exploitgym (function, line 241) def test_command_set_declares_exploitgym()
    • test_bridge_catalog_has_exploitgym (function, line 248) def test_bridge_catalog_has_exploitgym()
    • fake_which (function, line 87) def fake_which(name)
    • fake_which (function, line 102) def fake_which(name)
    • fake_which (function, line 118) def fake_which(name)
    • FakeProc (class, line 143) class FakeProc
    • fake_run (function, line 148) def fake_run(cmd, cwd, capture_output, text, timeout, env)
    • FakeProc (class, line 177) class FakeProc
    • fake_run (function, line 182) def fake_run(cmd, cwd, capture_output, text, timeout, env)
    • fake_record (function, line 195) def fake_record(challenge_id, success, elo_bonus, techniques)
    • fake_run_streaming (function, line 226) def fake_run_streaming(cmd, cwd, timeout)
  • Depends on: cli/commands/exploitgym.py, modules/exploitgym_gym.py, modules/lazyown_bridge.py

Next: KB_tests_p8.md