add: characterization tests for the four kept provider imports #135

Merged
mysticalsoap merged 1 commit from add/provider-parsing-tests into trunk 2026-08-24 01:18:54 -04:00
Owner

Problem

#23 gates the provider base-class refactor on the parsing having test coverage — the six routines encode undocumented API knowledge (AirVPN's RSA+AES handshake, Windscribe's CSRF login, Mullvad's scraped table) that a blind refactor would lose. None of it was tested.

Fix

Characterization tests for the four providers #134 keeps: Airvpn, Mullvad, Windscribe, ProtonVPN. A FakeRequests/FakeSession pair stands in for the requests surface update actually uses; dig and iptables are stubbed. Fixtures are trimmed live captures (2026-08-24) of the two still-public endpoints (Mullvad WG relay list, Windscribe server list); everything the live services no longer serve or keep behind credentials is synthetic, shaped by what the parsers read. The Airvpn fake encrypts its replies with the AES key the thread generates, so the real decrypt path runs.

Deliberately pinned quirks, so the refactor preserves or knowingly changes them: Windscribe's ip←ip2/ip2←ip3 field offset and trailing-space city names, Mullvad's legacy OpenVPN protocol table, and today's two live failures (Mullvad's table-less servers page, Windscribe's 404ing cert bundle) each ending as a reported failed import rather than a crash (#32).

Verification

pytest — 324 passed, including the 36 in tests/test_update.py (14 new). ruff check --select E9,F63,F7,F82 . and the SyntaxWarning compileall gate both clean. No test needs network, root or a VPN account; the file's header promise still holds.

## Problem #23 gates the provider base-class refactor on the parsing having test coverage — the six routines encode undocumented API knowledge (AirVPN's RSA+AES handshake, Windscribe's CSRF login, Mullvad's scraped table) that a blind refactor would lose. None of it was tested. ## Fix Characterization tests for the four providers #134 keeps: Airvpn, Mullvad, Windscribe, ProtonVPN. A `FakeRequests`/`FakeSession` pair stands in for the requests surface `update` actually uses; dig and iptables are stubbed. Fixtures are trimmed live captures (2026-08-24) of the two still-public endpoints (Mullvad WG relay list, Windscribe server list); everything the live services no longer serve or keep behind credentials is synthetic, shaped by what the parsers read. The Airvpn fake encrypts its replies with the AES key the thread generates, so the real decrypt path runs. Deliberately pinned quirks, so the refactor preserves or knowingly changes them: Windscribe's ip←ip2/ip2←ip3 field offset and trailing-space city names, Mullvad's legacy OpenVPN protocol table, and today's two live failures (Mullvad's table-less servers page, Windscribe's 404ing cert bundle) each ending as a reported failed import rather than a crash (#32). ## Verification `pytest` — 324 passed, including the 36 in `tests/test_update.py` (14 new). `ruff check --select E9,F63,F7,F82 .` and the SyntaxWarning compileall gate both clean. No test needs network, root or a VPN account; the file's header promise still holds.
add: characterization tests for the four kept provider imports
All checks were successful
ci / test (pull_request) Successful in 28s
ci / test (push) Successful in 49s
bba915d3fe
The provider routines encode undocumented API knowledge, and #23 refuses
to refactor them until that knowledge is pinned. These tests pin the
Airvpn, Mullvad, Windscribe and ProtonVPN routines (#134 drops the other
two) through a fake of the requests surface update actually uses --
Session plus module-level get/post sharing one exceptions object.

The JSON fixtures are trimmed live captures (2026-08-24) of the two
still-public endpoints: Mullvad's WireGuard relay list and Windscribe's
server list. Shapes the live services no longer serve (Mullvad's scraped
server table, WINDFLIX entries) or that sit behind paid credentials
(Airvpn's encrypted XML, Proton's logicals) are synthetic, matching what
the parser reads. The Airvpn fake encrypts replies with the AES key the
thread itself generates, so the decrypt path runs without the server's
RSA key.

Two tests pin today's live failures on purpose: Mullvad's table-less
servers page and Windscribe's 404ing cert bundle each end as a reported
failed import (#32).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
mysticalsoap deleted branch add/provider-parsing-tests 2026-08-24 01:18:54 -04:00
Sign in to join this conversation.
No description provided.