refactor: rename project to LedGrab, split HA integration into separate repo
Lint & Test / test (push) Successful in 1m56s
Lint & Test / test (push) Successful in 1m56s
- Rename Python package: wled_controller -> ledgrab - Rename env var prefix: WLED_ -> LEDGRAB_ (with auto-migration for old vars) - Rename localStorage key: wled_api_key -> ledgrab_api_key (with migration) - Rename HA integration domain: wled_screen_controller -> ledgrab - Update all imports, build scripts, Docker, installer, config, docs - Remove HA integration (moved to ledgrab-haos-integration repo) - Remove hacs.json (belongs in HA repo now) - Add startup warning for users with old WLED_ env vars - All tests pass (715/715), ruff clean, tsc clean, frontend builds
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from wled_controller.storage.value_source import (
|
||||
from ledgrab.storage.value_source import (
|
||||
AdaptiveValueSource,
|
||||
AnimatedValueSource,
|
||||
AudioValueSource,
|
||||
@@ -10,7 +10,7 @@ from wled_controller.storage.value_source import (
|
||||
StaticValueSource,
|
||||
ValueSource,
|
||||
)
|
||||
from wled_controller.storage.value_source_store import ValueSourceStore
|
||||
from ledgrab.storage.value_source_store import ValueSourceStore
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -149,8 +149,10 @@ class TestValueSourceStoreCRUD:
|
||||
|
||||
def test_create_animated(self, store):
|
||||
s = store.create_source(
|
||||
name="A1", source_type="animated",
|
||||
waveform="sawtooth", speed=20.0,
|
||||
name="A1",
|
||||
source_type="animated",
|
||||
waveform="sawtooth",
|
||||
speed=20.0,
|
||||
)
|
||||
assert isinstance(s, AnimatedValueSource)
|
||||
assert s.waveform == "sawtooth"
|
||||
@@ -158,8 +160,10 @@ class TestValueSourceStoreCRUD:
|
||||
|
||||
def test_create_audio(self, store):
|
||||
s = store.create_source(
|
||||
name="Au1", source_type="audio",
|
||||
audio_source_id="as_1", mode="beat",
|
||||
name="Au1",
|
||||
source_type="audio",
|
||||
audio_source_id="as_1",
|
||||
mode="beat",
|
||||
)
|
||||
assert isinstance(s, AudioValueSource)
|
||||
assert s.mode == "beat"
|
||||
@@ -170,7 +174,9 @@ class TestValueSourceStoreCRUD:
|
||||
{"time": "20:00", "value": 1.0},
|
||||
]
|
||||
s = store.create_source(
|
||||
name="AT", source_type="adaptive_time", schedule=schedule,
|
||||
name="AT",
|
||||
source_type="adaptive_time",
|
||||
schedule=schedule,
|
||||
)
|
||||
assert isinstance(s, AdaptiveValueSource)
|
||||
assert len(s.schedule) == 2
|
||||
@@ -178,14 +184,18 @@ class TestValueSourceStoreCRUD:
|
||||
def test_create_adaptive_time_insufficient_schedule(self, store):
|
||||
with pytest.raises(ValueError, match="at least 2 points"):
|
||||
store.create_source(
|
||||
name="Bad", source_type="adaptive_time",
|
||||
name="Bad",
|
||||
source_type="adaptive_time",
|
||||
schedule=[{"time": "12:00", "value": 0.5}],
|
||||
)
|
||||
|
||||
def test_create_daylight(self, store):
|
||||
s = store.create_source(
|
||||
name="DL", source_type="daylight",
|
||||
speed=2.0, use_real_time=True, latitude=48.0,
|
||||
name="DL",
|
||||
source_type="daylight",
|
||||
speed=2.0,
|
||||
use_real_time=True,
|
||||
latitude=48.0,
|
||||
)
|
||||
assert isinstance(s, DaylightValueSource)
|
||||
assert s.use_real_time is True
|
||||
@@ -247,7 +257,8 @@ class TestValueSourceNameUniqueness:
|
||||
|
||||
class TestValueSourcePersistence:
|
||||
def test_persist_and_reload(self, tmp_path):
|
||||
from wled_controller.storage.database import Database
|
||||
from ledgrab.storage.database import Database
|
||||
|
||||
db = Database(tmp_path / "vs_persist.db")
|
||||
s1 = ValueSourceStore(db)
|
||||
src = s1.create_source("Persist", "static", value=0.42)
|
||||
|
||||
Reference in New Issue
Block a user