mitmproxy/test
NeedmeFordev 73b8608232
Add ZIP content view for issue #8051 (#8054)
* Add ZIP content view for issue #8051

- Implement ZipContentview with ZIP file parsing
- Display file metadata (names, sizes, compression methods, dates, comments)
- Add comprehensive test suite with 12 test cases covering all scenarios
- Register view in contentviews module
- Achieve 100% test coverage

Fixes #8051

* [autofix.ci] apply automated fixes

* Add coverage tests for ZIP content view exception handling

- Add test_view_zip_invalid_date_time to cover ValueError exception
- Add test_view_zip_overflow_date_time to cover OverflowError exception
- Add test_view_zip_general_exception to cover general Exception handler
- Achieves 100% code coverage for _view_zip.py

* Update ZIP content view to match unzip -l and unzip -l -v formats

- Standard view now matches unzip -l format with Length, Date, Time, Name columns
- Added verbose view matching unzip -l -v format with compression details
- Updated tests to assert against new table-like output format
- Added comprehensive test coverage for both standard and verbose views
- Handles edge cases: empty archives, different compression methods, invalid dates

* Fix lint errors: remove unused variables

- Remove unused max_date and max_time variables from ZIP content views
- Fix import ordering in test file

* Fix PR feedback: separator hyphen count and CRC spacing

* Fix PR feedback: separator hyphen count and CRC spacing

* Simplify ZIP contentview per maintainer feedback

* Add test cases for ZIP contentview

* Simplify ZIP contentview: compact one-line format per file

* Simplify ZIP contentview: use yaml_dumps for safe filename output

- Output just filenames as YAML list (no size info)
- Use yaml_dumps() to avoid template injection risk
- Remove try/catch, let framework handle exceptions
- Return '(empty zip file)' for empty archives
- Reduce test suite to minimal golden test with edge cases

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-01-30 22:15:07 +01:00
..
bench
examples introduce new contentview API (#7623) 2025-04-21 14:56:58 +02:00
helper_tools
mitmproxy Add ZIP content view for issue #8051 (#8054) 2026-01-30 22:15:07 +01:00
wg-test-client
__init__.py
conftest.py Run pyupgrade and improve f-strings (#7837) 2025-08-19 20:15:46 +02:00
filename_matching.py
individual_coverage.py
run-tests-offline.sh switch to uv (#7662) 2025-04-16 18:38:35 +02:00