Skip to content

test(tools): comprehensive test suite for search_exploit_db, search_packetstorm, query_threat_intelligence_feeds, obtain_cves - #90

Open
manus-use wants to merge 1 commit into
manus-use:mainfrom
manus-pi:feat/exploit-search-tools-tests
Open

test(tools): comprehensive test suite for search_exploit_db, search_packetstorm, query_threat_intelligence_feeds, obtain_cves#90
manus-use wants to merge 1 commit into
manus-use:mainfrom
manus-pi:feat/exploit-search-tools-tests

Conversation

@manus-use

Copy link
Copy Markdown
Owner

Summary

Adds tests/test_exploit_search_tools.py — a comprehensive, fully-mocked test suite covering four tools that previously had zero dedicated test coverage:

Tool Tests added Notes
search_exploit_db 21 TOOL_SPEC contract, input validation, HTML parse, error paths, toolUseId echo
search_packetstorm 22 TOOL_SPEC contract, input validation, HTML parse, error paths, result structure
query_threat_intelligence_feeds 19 TOOL_SPEC contract, input validation, CVE found/not-found, case-insensitive match, per-feed error degradation
obtain_cves 19 TOOL_SPEC contract, _get_all_cves_from_nvd (single/paginated/empty), _get_all_cves_from_github (single/pagination/error/no-cve-id), _filter_cves_by_epss (pass/block/percentile/empty/missing), tool entry point (merge, dedup, chunking, error handling), _enrich_with_cisa_kev
Cross-tool (vi_agent wiring) 6 Confirms all three vi_agent exploit-search tools referenced + importable
Parametrised TOOL_SPEC contract 20 4 tools × 5 invariants each

Total: 107 new tests (902 → 1019 passing, 0 failures, 3 pre-existing deselections unchanged).

Why these tools?

These four tools are wired into the core vi_agent pipeline (manus-agent analyze) and the vd_agent discover loop. Despite being actively used in production pipelines, they had no dedicated test file. Any regression in HTML parsing, EPSS filtering, or pagination logic would go completely undetected.

Test design

  • 100% mocked HTTPunittest.mock.patch on requests.get; no real network calls.
  • Edge cases covered: empty query, whitespace-only, None, integer type coercion, missing keys, HTTP 4xx/5xx, ConnectionError, Timeout, generic Exception, empty response bodies, pagination boundary.
  • Behavioural tests: CVE deduplication across NVD+GitHub sources, EPSS dual-threshold logic (absolute score > 0.05 OR percentile > 0.5), chunked EPSS calls (≤100 per request), CISA KEV enrichment correctness, toolUseId round-trip echoing.
  • Living-doc tests: vi_agent wiring checks confirm tool module paths remain importable and referenced in the system prompt.

Existing open PRs checked for overlap (none)

#51, #53, #54, #58, #60, #64, #65, #67, #74, #75, #76, #77, #78, #79, #80, #82, #83, #85, #86, #87, #88, #89

No open or merged PR covers search_exploit_db, search_packetstorm, query_threat_intelligence_feeds, or obtain_cves test suites.

…acketstorm, query_threat_intelligence_feeds, obtain_cves
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant