Adds a dedicated unit test `test_refresh_netsets_read_and_parse` in `tests/test_reputation.py` to directly cover the inner function `read_and_parse()` of `refresh_netsets`. The test uses a mocked file layout and `unittest.mock.patch` on `pathlib.Path.read_text` to simulate reading a cached `.netset` file, bringing the coverage of `src/netsleuth/reputation.py` up to 100%.
Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com>
* 🧪 Add tests for check_fresh and improve coverage in reputation.py
* Extract `check_fresh` to a module-level function for testability.
* Add comprehensive tests for `check_fresh` covering missing, fresh, and stale cache files.
* Add a missing test for `reverse_ip` with IPv6 to hit 100% coverage on `reputation.py`.
Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com>
* drop redundant pytest-cov dep addition
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit adds a new test file, `tests/test_cli.py`, containing
unit tests for the `_os_timezone` function in `netsleuth.cli`.
The tests cover:
- Happy paths (TZ variable, /etc/localtime symlink, /etc/timezone file)
- The edge case of an `OSError` exception being thrown when reading the
/etc/timezone file.
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>