test(cli): comprehensive test suite for manus-agent osv subcommand + README docs - #120
Open
manus-use wants to merge 1 commit into
Open
test(cli): comprehensive test suite for manus-agent osv subcommand + README docs#120manus-use wants to merge 1 commit into
manus-use wants to merge 1 commit into
Conversation
The `osv` subcommand was merged in PR #97 but had zero CLI-level test coverage. The fetch_osv_data() function itself is tested in test_osv_data.py (408 lines), but _build_osv_parser(), _run_osv(), and the main() dispatch path for "osv" were completely untested. This PR adds tests/test_cli_osv.py with 51 tests across 6 suites: - TestBuildOsvParser (10): prog string, required positional CVE-ID, output flag defaults/choices (text/json), invalid choice rejection, --help output, description mentions OSV/CVE. - TestRunOsvJsonOutput (7): found/not-found/error payloads produce valid JSON; records, aliases, affected_ecosystems present in output. - TestRunOsvTextOutput (14): not-found message printed; found message with aliases, OSV record IDs, package ecosystem:name, introduced/ fixed versions, severity; no-fix placeholder "(no fixed version listed)"; last_affected shown; empty aliases suppressed; empty packages skips record block; empty severity score suppressed; multiple records all printed; introduced defaults to "0" when empty. - TestRunOsvErrors (6): error payload prints message; error payload JSON still valid; missing CVE-ID exits nonzero; invalid output choice exits nonzero; CVE-ID passed to fetch_osv_data unchanged; whitespace stripped before dispatch. - TestSubcommandsRegistry (3): "osv" in _SUBCOMMANDS, is a set, no dup. - TestMainDispatchOsv (5): main() routes osv subcommand; JSON flag forwarded; not-found exits zero; does not route to single-shot; fetch_osv_data called with correct CVE-ID. - TestRunOsvImportPath (4): fetch_osv_data importable; rc is int; returns 0 for text and json success paths. Also adds `manus-agent osv` to README.md (section + TOC entry): the subcommand was shipping but completely undocumented.
This was referenced Jul 13, 2026
This was referenced Jul 22, 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(cli): comprehensive test suite for
manus-agent osvCLI subcommandWhat this PR does
The
osvsubcommand was introduced in merged PR #97 (feat(tools): OSV.dev affected-package resolver — get_osv_data tool + manus-agent osv CLI) but had zero CLI-level test coverage.The fetch_osv_data() function itself is tested in
test_osv_data.py(408 lines / 32 tests), but three things were completely untested:_build_osv_parser()— argparse setup for theosvsubcommand_run_osv()— all output branches (text / JSON / not-found / error / edge cases)main()dispatch — routing whenargv[0]is"osv"Additionally,
manus-agent osvwas not documented in README.md. The subcommand shipped and worked but had no entry in the CLI reference or table of contents.Changes
tests/test_cli_osv.py— 51 new tests across 6 suitesTestBuildOsvParser--outputdefault/choices/rejection, help text, description contentTestRunOsvJsonOutputrecords,aliases,affected_ecosystemspresentTestRunOsvTextOutputecosystem:name, introduced/fixed versions, severity;(no fixed version listed)placeholder;Last affectedline; empty aliases suppressed; empty packages skips record block; empty severity score suppressed; multiple records all printed;introduceddefaults to"0"when emptyTestRunOsvErrors--outputexits nonzero; CVE-ID forwarded tofetch_osv_data; whitespace strippedTestSubcommandsRegistry"osv"in_SUBCOMMANDS; is a set; no duplicateTestMainDispatchOsvmain()routesosv;--output jsonforwarded; not-found exits 0; does not fall through to single-shot;fetch_osv_datacalled with correct CVE-IDTestRunOsvImportPathfetch_osv_dataimportable;_run_osvreturns int; returns 0 on text/json successREADME.mdmanus-agent osv <CVE-ID>section betweenpoc-searchandblast-radius[osv](#manus-agent-osv-cve-id--osvdev-package-level-version-ranges)Test results
(1158 baseline + 51 new; zero failures)
Existing open PRs checked against — no overlap
This PR adds test coverage and docs for an already-merged feature (PR #97). It does not implement any new tool or CLI subcommand, so there is no overlap with any existing open PR.
Open PRs verified as non-overlapping:
#51, #53, #54, #58, #60, #64, #65, #67, #74, #75, #76, #77, #78, #79, #80, #82, #83, #85, #86, #87, #88, #89, #90, #96, #98, #100, #103, #104, #105, #106, #107, #108, #109, #110, #111, #112, #113, #114, #115, #116, #117, #118, #119
None of those PRs add tests for
_run_osvor_build_osv_parser.