test: real-DB migration test (#14) #15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "test/14-migration-db"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #14. Adds
tests/test_migrations.py— the regression guard for the class of bug that #13 was.What it does
Runs the full
m0NNmigration chain against a fresh temp SQLite via the lnbitsDatabase, then round-trips a room + booking throughcrud:m002checkin_instructionscolumn,big_intamount columns, andis_availableon real rows (not monkeypatched).Isolation (the wrinkle, solved)
Databasebinds its sqlite path + engine at construction fromsettings.lnbits_data_folder, andcrud.dbis built at import — so late env vars don't help. Approach: monkeypatchsettings.lnbits_data_folder→tmp_path, build a freshext_chateletDatabase, and swap it intocrudfor the test. Import-order-independent, per-test isolation, no live server.It has teeth
Verified by reintroducing the #13 bad-index syntax (
CREATE INDEX ... ON chatelet.<table>) → the test fails withsqlite3.OperationalError: near ".": syntax error. Restored; 23 pass (22 + this).Why PR
Test-only, but on a money-adjacent extension → PR category. Handing off merge to you via the Forgejo UI.
🤖 Generated with Claude Code