test(tools): comprehensive test suite for check_cisa_kev module (+43 tests) - #165
Open
manus-use wants to merge 1 commit into
Open
test(tools): comprehensive test suite for check_cisa_kev module (+43 tests)#165manus-use wants to merge 1 commit into
manus-use wants to merge 1 commit into
Conversation
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.
Summary
Comprehensive test suite for the
check_cisa_kevtool module — 43 fully-mocked tests covering:Coverage areas
_get_kev_datacaching logic — fresh cache hit, stale cache refetch, missing cache, network errors (ConnectionError, Timeout), cache write verification, missing timestamp handling, malformed cache file behaviourcheck_cisa_kevmain function — CVE found (exploit confirmed), CVE not found, case-insensitive matching, exact match (no partial), multiple CVEs in catalog, empty catalog, missing vulnerabilities key, empty/None/integer input validation, tool_use_id propagationlog_tool_output_sizeintegration — called on every exit path (found, not found, invalid input, data retrieval error)Discovered issue
The test suite documents a known limitation:
_get_kev_data()does not wrapjson.loads()in a try/except when reading the cache file. A corrupted.cisa_kev_cache.jsonwill propagate aJSONDecodeErrorrather than falling through to a fresh API fetch. This is documented astest_malformed_cache_file_raises_json_error.Test results
Baseline: 1158 tests + 43 new = 1201 total, 0 failures.
Open PRs checked (no overlap)
Reviewed all 50 open PRs (#115–#164). The closest is #122 (
feat(cli): add check-kev subcommand) which adds a CLI subcommand — this PR adds unit tests for the underlying tool module (check_cisa_kev), which is a completely different concern. No existing open or merged PR provides test coverage for thecheck_cisa_kevtool function or its_get_kev_datacaching helper.