test(core-tools): comprehensive test suite for check_cisa_kev, get_nvd_data, get_cwe_details, get_otx_cve_details - #89
Open
manus-use wants to merge 1 commit into
Open
Conversation
…d_data, get_cwe_details, get_otx_cve_details Add 104 fully-mocked unit tests covering the four foundation tools that power every `manus-agent analyze` pipeline run but previously had zero dedicated test files. Coverage per tool: - check_cisa_kev (32 tests): import, TOOL_SPEC, input validation, KEV found/not-found, case-insensitive lookup, caching (miss/hit/expired/write), network error degradation, empty catalog handling - get_nvd_data (17 tests): import, TOOL_SPEC, input validation, successful lookup, cve_id uppercasing, cisa_kev_info injection, empty response, RequestException, JSONDecodeError, generic and HTTP errors - get_cwe_details (18 tests): import, TOOL_SPEC, CWE-prefixed and numeric validation, HTML parse (description/extended/missing div), URL construction, case-insensitive input, RequestException, generic and HTTP errors - get_otx_cve_details (21 tests): import, TOOL_SPEC, input validation, missing API key (env + config path), config fallback, successful pulse response, empty pulses, URL uppercasing, header auth verification, 404→success, 5xx→error, JSONDecodeError, generic errors - TOOL_SPEC contract (16 parametrised tests): all four tools satisfy name/description/inputSchema/required-fields contract - VI agent wiring (6 tests): all four tool names present in SYSTEM_PROMPT; all four module paths importable; all four paths referenced in vi_agent source Suite size: 902 → 1006 passing (+104), 0 failures, 0 real HTTP calls
This was referenced Jul 5, 2026
This was referenced Jul 7, 2026
This was referenced Jul 11, 2026
This was referenced Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test(core-tools): comprehensive test suite for check_cisa_kev, get_nvd_data, get_cwe_details, get_otx_cve_details
Motivation
Every
manus-agent analyzeinvocation exercises a fixed pipeline:These four tools are the foundation of the entire VA agent — they are called in steps 1, 2, 3, and the CWE lookup step of every vulnerability analysis. Despite this central role, they had zero dedicated test files before this PR.
What this PR adds
tests/test_core_tools.py— 104 fully-mocked unit tests (no real HTTP calls).check_cisa_kevget_nvd_dataCVE-prefix/non-string/None), successful lookup, CVE ID uppercased in URL,cisa_kev_infoinjection, emptyvulnerabilities,RequestException,JSONDecodeError, generic exception, HTTP 4xxget_cwe_detailsRequestException,HTTPError, generic exceptionget_otx_cve_detailsX-OTX-API-KEYheader, config key used when env absent,RequestException, HTTP 404→success, HTTP 5xx→error,JSONDecodeError, generic exceptionTestToolSpecContractname/description/inputSchema/requiredcontract (parametrised)TestViAgentWiringSYSTEM_PROMPT; all four module paths importable; all four paths referenced invi_agentsourceResults
Why these tests matter
check_cisa_kevhad a caching layer (CACHE_FILE) with three distinct states (miss / fresh hit / expired) that were completely untestedOpen PRs checked (no overlap)
This PR adds test coverage for existing tools only — no new tool or CLI subcommand. Checked against all 21 currently open PRs to confirm zero overlap:
#51 (silent-patches), #53 (cve-timeline), #54 (version-range), #58 (vendor-response), #60 (poc-freshness), #64 (sbom-scan), #65 (temporal-priority), #67 (cluster-variants), #74 (epss-decay), #75 (exploit-maturity), #76 (assess/triage), #77 (report), #78 (diff-report), #79 (reachability), #80 (epss-watchlist), #82 (attack-surface), #83 (watch-alert), #85 (CLI integration tests — tests existing CLI commands, not these four base tools), #86 (patch-status), #87 (risk-score), #88 (vendor-response subcommand).
None of the above touch
check_cisa_kev,get_nvd_data,get_cwe_details, orget_otx_cve_details.