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

@@ -11,8 +11,8 @@ from wled_controller.storage.key_colors_output_target import (
@pytest.fixture
def store(tmp_path) -> OutputTargetStore:
return OutputTargetStore(str(tmp_path / "output_targets.json"))
def store(tmp_db) -> OutputTargetStore:
return OutputTargetStore(tmp_db)
# ---------------------------------------------------------------------------
@@ -193,8 +193,10 @@ class TestOutputTargetQueries:
class TestOutputTargetPersistence:
def test_persist_and_reload(self, tmp_path):
path = str(tmp_path / "ot_persist.json")
s1 = OutputTargetStore(path)
from wled_controller.storage.database import Database
db_path = str(tmp_path / "ot_persist.db")
db = Database(db_path)
s1 = OutputTargetStore(db)
t = s1.create_target(
"Persist", "led",
device_id="dev_1",
@@ -203,8 +205,9 @@ class TestOutputTargetPersistence:
)
tid = t.id
s2 = OutputTargetStore(path)
s2 = OutputTargetStore(db)
loaded = s2.get_target(tid)
assert loaded.name == "Persist"
assert isinstance(loaded, WledOutputTarget)
assert loaded.tags == ["tv"]
db.close()