fix: update test fixtures for SQLite storage migration
Some checks failed
Lint & Test / test (push) Failing after 1m33s

All store tests were passing file paths instead of Database objects
after the JSON-to-SQLite migration. Updated fixtures to create temp
Database instances, rewrote backup e2e tests for binary .db format,
and fixed config tests for the simplified StorageConfig.
This commit is contained in:
2026-03-25 11:38:07 +03:00
parent 9dfd2365f4
commit 2da5c047f9
12 changed files with 135 additions and 126 deletions

View File

@@ -18,8 +18,8 @@ from wled_controller.storage.automation_store import AutomationStore
@pytest.fixture
def store(tmp_path) -> AutomationStore:
return AutomationStore(str(tmp_path / "automations.json"))
def store(tmp_db) -> AutomationStore:
return AutomationStore(tmp_db)
# ---------------------------------------------------------------------------
@@ -240,16 +240,18 @@ class TestAutomationNameUniqueness:
class TestAutomationPersistence:
def test_persist_and_reload(self, tmp_path):
path = str(tmp_path / "auto_persist.json")
s1 = AutomationStore(path)
from wled_controller.storage.database import Database
db = Database(tmp_path / "auto_persist.db")
s1 = AutomationStore(db)
a = s1.create_automation(
name="Persist",
conditions=[WebhookCondition(token="t1")],
)
aid = a.id
s2 = AutomationStore(path)
s2 = AutomationStore(db)
loaded = s2.get_automation(aid)
assert loaded.name == "Persist"
assert len(loaded.conditions) == 1
assert isinstance(loaded.conditions[0], WebhookCondition)
db.close()