Skip to content

Commit

Permalink
Add name collision test.
Browse files Browse the repository at this point in the history
  • Loading branch information
denpamusic committed Dec 17, 2023
1 parent de7ee70 commit e2a74e0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
from pyplumio.helpers.schedule import Schedule
from pyplumio.structures.ecomax_parameters import (
ATTR_ECOMAX_CONTROL,
ECOMAX_PARAMETERS,
EcomaxBinaryParameter,
EcomaxParameter,
)
Expand Down Expand Up @@ -191,6 +192,20 @@ async def test_ecomax_data_callbacks(ecomax: EcoMAX) -> None:
assert ecomax_control.request.data == {ATTR_VALUE: 0}


async def test_ecomax_naming_collisions(ecomax: EcoMAX) -> None:
"""Test that ecoMAX sensors doesn't collide with ecoMAX parameters."""
test_data = load_json_test_data("messages/sensor_data.json")[0]
ecomax.handle_frame(SensorDataMessage(message=test_data["message"]))
await ecomax.wait_until_done()
for descriptions in ECOMAX_PARAMETERS.values():
collisions = [
description.name
for description in descriptions
if description.name in ecomax.data
]
assert not collisions, f"found collisions: {collisions}"


async def test_ecomax_parameters_callbacks(ecomax: EcoMAX) -> None:
"""Test callbacks dispatched on parameter frames."""
test_data = load_json_test_data("responses/ecomax_parameters.json")[0]
Expand Down

0 comments on commit e2a74e0

Please sign in to comment.