test: raise coverage 68.7% -> ~80.4%; add ~250 tests for new egress/DDNS/network paths
Unit Tests / test (push) Successful in 12m6s

Coverage was below acceptable levels and several newly-added code paths
(sshuttle egress, proxy egress, DDNS provider stubs, DNS overview route,
peer-registry provisioning) had zero test coverage.

~250 new unit tests are added across 16 new test files. Existing test files
are updated to match refactored interfaces (DHCP removed, constants
introduced, network_manager restructured). .coveragerc is added to pin the
source mapping and the 70% floor so regressions are caught at commit time.

tests/test_enhanced_api.py was previously living in api/ (wrong location)
and is moved to tests/ where it belongs.

Integration test files are updated to remove references to DHCP endpoints
and add coverage for the new DNS overview and DDNS sync endpoints.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 09:03:39 -04:00
parent c41cadafb4
commit aa1e5c41ec
33 changed files with 9446 additions and 631 deletions
@@ -11,7 +11,6 @@ Endpoints covered:
- /api/peers (POST, PUT, DELETE)
- /api/config (PUT)
- /api/dns/records (DELETE)
- /api/dhcp/reservations (POST, DELETE)
- /api/containers/<name>/restart
- /api/wireguard/keys/peer
@@ -240,43 +239,6 @@ class TestDnsRecordsNegative:
r.json()
# ---------------------------------------------------------------------------
# DHCP reservations — negative
# ---------------------------------------------------------------------------
class TestDhcpReservationsNegative:
def test_add_reservation_no_body_returns_400(self):
r = _S.post(
f"{API_BASE}/api/dhcp/reservations",
data='',
headers={'Content-Type': 'application/json'},
)
assert r.status_code == 400
def test_add_reservation_missing_ip_returns_400(self):
r = post('/api/dhcp/reservations', json={'mac': 'aa:bb:cc:dd:ee:ff'})
assert r.status_code == 400
_assert_json_error(r)
def test_add_reservation_missing_mac_returns_400(self):
r = post('/api/dhcp/reservations', json={'ip': '10.0.0.250'})
assert r.status_code == 400
_assert_json_error(r)
def test_delete_reservation_no_mac_returns_400(self):
r = delete('/api/dhcp/reservations', json={'ip': '10.0.0.250'})
assert r.status_code == 400
_assert_json_error(r)
def test_delete_reservation_empty_body_returns_400(self):
r = _S.delete(
f"{API_BASE}/api/dhcp/reservations",
data='',
headers={'Content-Type': 'application/json'},
)
assert r.status_code == 400
# ---------------------------------------------------------------------------
# Container endpoints — negative
# ---------------------------------------------------------------------------