test: add test harness + suite (incl. #4 concurrency regression) #10

Merged
padreug merged 2 commits from feat/tests-harness into main 2026-07-19 15:49:25 +00:00

2 commits

Author SHA1 Message Date
7d704a8549 test: booking-flow, availability, and #4 concurrency regression
16 tests, run under the LNbits pytest env (spirekeeper pattern: monkeypatch
crud/invoice, drive async via asyncio.run — no live DB/wallet):

- test_availability: half-open overlap semantics (back-to-back stays OK),
  and is_available blocking on held/confirmed bookings + manual blocks.
- test_booking_flow: canonical amount_sat, awaiting_payment transition,
  min-nights guard, and hold-release (declined) on InvoiceError.
- test_atomic_hold: the #4 regression — two concurrent same-date requests
  yield exactly one hold + one conflict; non-overlapping both succeed. The
  fakes yield mid-check to open the race window, so the test fails without
  the per-room lock (verified by neutering it) and passes with it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019VUQCfdqiLSsFS2jcGnaFD
2026-07-19 17:48:11 +02:00
8b50263aac chore: add test + lint tooling (pyproject, Makefile)
Poetry/pytest/ruff/black/mypy config mirroring the aio extension lint
pipeline (spirekeeper template). `make test` runs pytest; `make check`
runs the linters. Enables a tests/ suite for the extension.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019VUQCfdqiLSsFS2jcGnaFD
2026-07-19 17:48:11 +02:00