fix: update test fixtures for SQLite storage migration
Some checks failed
Lint & Test / test (push) Failing after 1m33s
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:
@@ -14,8 +14,8 @@ from wled_controller.storage.value_source_store import ValueSourceStore
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def store(tmp_path) -> ValueSourceStore:
|
||||
return ValueSourceStore(str(tmp_path / "value_sources.json"))
|
||||
def store(tmp_db) -> ValueSourceStore:
|
||||
return ValueSourceStore(tmp_db)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -247,13 +247,15 @@ class TestValueSourceNameUniqueness:
|
||||
|
||||
class TestValueSourcePersistence:
|
||||
def test_persist_and_reload(self, tmp_path):
|
||||
path = str(tmp_path / "vs_persist.json")
|
||||
s1 = ValueSourceStore(path)
|
||||
from wled_controller.storage.database import Database
|
||||
db = Database(tmp_path / "vs_persist.db")
|
||||
s1 = ValueSourceStore(db)
|
||||
src = s1.create_source("Persist", "static", value=0.42)
|
||||
sid = src.id
|
||||
|
||||
s2 = ValueSourceStore(path)
|
||||
s2 = ValueSourceStore(db)
|
||||
loaded = s2.get_source(sid)
|
||||
assert loaded.name == "Persist"
|
||||
assert isinstance(loaded, StaticValueSource)
|
||||
assert loaded.value == 0.42
|
||||
db.close()
|
||||
|
||||
Reference in New Issue
Block a user