mirror of
https://github.com/pi-hole/FTL.git
synced 2026-07-03 05:45:44 +01:00
bb89fbfe7b
Add pytest tests for all previously untested GET API endpoints: dns/blocking, domains (all type/kind combinations and single lookup), groups, stats/summary, stats/top_domains, stats/top_clients, stats/upstreams, stats/query_types, stats/recent_blocked, stats/database (error handling), dhcp/leases, endpoints, info/ftl, info/login, info/version, info/messages, info/client, info/database, info/system, network/devices, network/interfaces, logs (dnsmasq, ftl, webserver), and padd. All assertions use exact expected values derived from the deterministic BATS DNS query seeding (137 total queries, 49 blocked, 47 forwarded, 41 cached, 11 active clients, 8 gravity domains). On failure, the full JSON response is dumped to /tmp/ftl_test_*.json for easy inspection. Fix double-free bug in printFTLenv() (src/config/env.c): when printFTLenv() was called more than once (e.g. after config reload triggered by the CLI password test), it would free item->error a second time because neither the pointer nor the error_allocated flag were reset after the first free. This produced "Trying to free NULL pointer in printFTLenv()" warnings. Fix: set item->error = NULL and item->error_allocated = false after freeing. Files modified: src/config/env.c — reset error/error_allocated after free test/api/test_api.py — add 34 new endpoint tests (22 -> 56 total) Signed-off-by: Dominik <dl6er@dl6er.de>