style: ruff nits in the my-bookings slice

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-09-16 12:18:15 +02:00
commit 8557ce617e
2 changed files with 26 additions and 22 deletions

View file

@ -4,6 +4,7 @@ guest's rows, and the Lightning/Nostr plumbing stays internal."""
import asyncio
from types import SimpleNamespace
from typing import Any
import pytest
from fastapi import HTTPException
@ -14,27 +15,27 @@ from ..models import Booking, BookingStatus, guest_booking_dict
PK = "ab" * 32
def _booking(i: int, **over) -> Booking:
base = dict(
id=f"bk{i}",
room_id="a",
guest_pubkey=PK,
guest_contact="me@example.com",
check_in=f"2026-10-{10 + i:02d}",
check_out=f"2026-10-{12 + i:02d}",
nights=2,
num_guests=1,
currency="EUR",
price_fiat=200.0,
amount_sat=300000,
deposit_sat=300000,
status=BookingStatus.confirmed,
payment_hash=f"ph{i}",
request_event_id="req",
reservation_event_id="res",
)
def _booking(i: int, **over: Any) -> Booking:
base: dict[str, Any] = {
"id": f"bk{i}",
"room_id": "a",
"guest_pubkey": PK,
"guest_contact": "me@example.com",
"check_in": f"2026-10-{10 + i:02d}",
"check_out": f"2026-10-{12 + i:02d}",
"nights": 2,
"num_guests": 1,
"currency": "EUR",
"price_fiat": 200.0,
"amount_sat": 300000,
"deposit_sat": 300000,
"status": BookingStatus.confirmed,
"payment_hash": f"ph{i}",
"request_event_id": "req",
"reservation_event_id": "res",
}
base.update(over)
return Booking(**base) # type: ignore[arg-type]
return Booking(**base)
def _patch_store(monkeypatch, rows):
@ -69,7 +70,9 @@ def test_http_lists_only_the_callers_rows(monkeypatch):
def test_http_rejects_account_without_pubkey(monkeypatch):
_patch_store(monkeypatch, [])
with pytest.raises(HTTPException) as e:
asyncio.run(views_api.api_my_bookings(user=SimpleNamespace(id="u1", pubkey=None)))
asyncio.run(
views_api.api_my_bookings(user=SimpleNamespace(id="u1", pubkey=None))
)
assert e.value.status_code == 409