test_pair_endpoint: 2 failures from #29 drift (fake_pair missing bunker_relay; test DB lacks super_config) #34

Open
opened 2026-06-22 14:56:17 +00:00 by padreug · 0 comments
Owner

Two tests in tests/test_pair_endpoint.py have been red since #29, surfaced while running the full suite for #33:

  1. test_pair_failure_maps_to_bad_gateway (and the persist test) — _wire's fake_pair mock signature is (machine, *, relays, admin_client, duration_hours=None), but #29 made api_pair_machine call pair_spire(..., bunker_relay=data.bunker_relay, ...)TypeError: fake_pair() got an unexpected keyword argument 'bunker_relay'.

  2. test_pair_persists_hex_npub_and_returns_seed — after fixing (1), it then hits sqlite3.OperationalError: no such table: spirekeeper.super_config at views_api.py api_pair_machine, because #29 added a post-pairing get_super_config() + publish_fee_config() that the test neither mocks nor provisions a table for.

Both are test drift from #29 (optional-npub + bunker_relay + post-pairing fee publish), not a production bug. Fix:

  • add bunker_relay=None, keystore_passphrase=None to the fake_pair mock;
  • monkeypatch views_api.get_super_config (→ a SuperConfig or None) and views_api.publish_fee_config in _wire, so the endpoint's post-pairing publish is exercised without a real DB.

Kept out of #33 (unpaired-machine guards) to keep that PR focused.

Two tests in `tests/test_pair_endpoint.py` have been red since #29, surfaced while running the full suite for #33: 1. **`test_pair_failure_maps_to_bad_gateway`** (and the persist test) — `_wire`'s `fake_pair` mock signature is `(machine, *, relays, admin_client, duration_hours=None)`, but #29 made `api_pair_machine` call `pair_spire(..., bunker_relay=data.bunker_relay, ...)` → `TypeError: fake_pair() got an unexpected keyword argument 'bunker_relay'`. 2. **`test_pair_persists_hex_npub_and_returns_seed`** — after fixing (1), it then hits `sqlite3.OperationalError: no such table: spirekeeper.super_config` at `views_api.py` `api_pair_machine`, because #29 added a post-pairing `get_super_config()` + `publish_fee_config()` that the test neither mocks nor provisions a table for. Both are **test drift from #29** (optional-npub + bunker_relay + post-pairing fee publish), not a production bug. Fix: - add `bunker_relay=None, keystore_passphrase=None` to the `fake_pair` mock; - monkeypatch `views_api.get_super_config` (→ a `SuperConfig` or `None`) and `views_api.publish_fee_config` in `_wire`, so the endpoint's post-pairing publish is exercised without a real DB. Kept out of #33 (unpaired-machine guards) to keep that PR focused.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aiolabs/spirekeeper#34
No description provided.