-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add failing test for VMBDALI * Fix VMBDALI Fixes #114
- Loading branch information
Showing
2 changed files
with
33 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pytest | ||
from unittest.mock import MagicMock | ||
|
||
from velbusaio.module import Module, VmbDali | ||
from velbusaio.handler import PacketHandler | ||
from velbusaio.helpers import h2 | ||
|
||
|
||
class MockWriter: | ||
async def __call__(self, data): | ||
pass | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_vmbdali_loads_and_has_channels(): | ||
ph = PacketHandler(None) | ||
await ph.read_protocol_data() | ||
|
||
module_address = 0x12 | ||
dali_type = 69 | ||
module = VmbDali( | ||
module_address, | ||
dali_type, | ||
ph.pdata["ModuleTypes"][h2(dali_type)], | ||
) | ||
writer = MockWriter() | ||
module.initialize(writer) | ||
|
||
await module.load() | ||
|
||
assert len(module._channels) > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters