test: add comprehensive tests for capture module#4
Merged
Conversation
Add tests for previously uncovered code to reach 82% coverage: - test_deps.py: Tests for check_playwright, check_browser_installed, install_browser, install_playwright, install_browser_deps - test_connectivity.py: Tests for check_device_connectivity and check_basic_auth with mocked urllib - test_har_processing.py: Tests for filter_and_compress_har and _add_capture_metadata - test_main_entry.py: Tests for __main__.py entry point Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…oncerns - Add workflow.py with phase-specific result types: - BrowserCheckResult: browser installation check - ConnectivityResult: connectivity check - AuthResult: authentication detection - CaptureResult: capture operation result - CaptureWorkflowResult composes phase results with convenience properties - cli/capture.py now thin CLI layer using workflow functions - Add comprehensive tests for all workflow types and functions (35 tests) This design makes each type testable in isolation and clarifies which fields are valid in which phase. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add tests for check_json_fields (nested JSON, lists, redacted values) - Add tests for check_content (public IPs, MAC addresses, empty content) - Add tests for validate_har (headers, POST data, gzipped files) - Add missing assertions for compressed_path/sanitized_path properties - Total coverage: 81% (up from 78%) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Convert check_json_fields tests to parametrized table - Convert check_content tests to parametrized table - Convert validate_har tests to parametrized table - Add ASCII table comments documenting test cases - Use # fmt: off/on to preserve column alignment Follows project's table-driven test pattern from CLAUDE.md. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Covers line 176 in hasher.py - the IPv6 cache lookup path. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Tests for _display_header, _display_instructions, _display_results, and _handle_auth functions. Increases cli/capture.py coverage from 7% to 66%. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add ASCII table documentation for each test group - Use pytest.mark.parametrize for all test cases - Add # fmt: off/on to preserve column alignment - Follows project test conventions from CLAUDE.md Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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
Add comprehensive tests for previously uncovered code to increase coverage towards 82%.
New Test Files
test_deps.py: Tests forcheck_playwright,check_browser_installed,install_browser,install_playwright,install_browser_depswith subprocess mockingtest_connectivity.py: Tests forcheck_device_connectivityandcheck_basic_authwith urllib mockingtest_har_processing.py: Tests forfilter_and_compress_harand_add_capture_metadatatest_main_entry.py: Tests for__main__.pyentry pointCoverage Improvements (unit tests only)
capture/deps.pycapture/connectivity.pycapture/browser.pyTest Count
Combined coverage (unit + integration) should reach ~80%+.
🤖 Generated with Claude Code