From b93e3fb698acf7a1bca9d6c40001be2b7626ef4a Mon Sep 17 00:00:00 2001 From: Padreug Date: Wed, 1 Jul 2026 21:16:10 +0200 Subject: [PATCH] test(pair-endpoint): update stale pair_spire double + mock get_super_config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pairing endpoint tests' fake_pair predated the bunker_relay parameter (views_api passes bunker_relay=data.bunker_relay), so it raised TypeError; and api_pair_machine later grew a get_super_config() read for the post-pair fee publish that the doubles never mocked, hitting a DB with no spirekeeper.super_config table. Both were pre-existing failures on main (masked one behind the other). Add bunker_relay to the fake_pair signature and mock get_super_config → None (the happy path doesn't exercise fee publishing). Suite green. Co-Authored-By: Claude Opus 4.8 --- tests/test_pair_endpoint.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/test_pair_endpoint.py b/tests/test_pair_endpoint.py index 0d50d95..745bbfe 100644 --- a/tests/test_pair_endpoint.py +++ b/tests/test_pair_endpoint.py @@ -66,7 +66,9 @@ def _wire(monkeypatch, *, pair="ok"): async def fake_owned(machine_id, user_id): return _machine() - async def fake_pair(machine, *, relays, admin_client, duration_hours=None): + async def fake_pair( + machine, *, relays, admin_client, bunker_relay=None, duration_hours=None + ): if pair == "error": raise PairingError("boom") return _result() @@ -80,11 +82,18 @@ def _wire(monkeypatch, *, pair="ok"): state["persisted"] = (machine_id, machine_npub, bunker_spire_key_name) return _machine(npub=machine_npub) + # After pairing, the endpoint reads super_config to publish fee config + # (soft-fail tail). None short-circuits it — the happy-path assertions + # don't exercise fee publishing, and it keeps the test off the DB. + async def fake_super_config(): + return None + monkeypatch.setattr(views_api, "_machine_owned_by", fake_owned) monkeypatch.setattr(views_api, "NsecBunkerAdminClient", _FakeAdmin) monkeypatch.setattr(views_api, "pair_spire", fake_pair) monkeypatch.setattr(views_api, "_assert_no_pubkey_collision", fake_collision) monkeypatch.setattr(views_api, "set_machine_pairing", fake_persist) + monkeypatch.setattr(views_api, "get_super_config", fake_super_config) return state