Skip to content

Commit

Permalink
add tests for missing data
Browse files Browse the repository at this point in the history
  • Loading branch information
marcolivierarsenault committed Aug 16, 2024
1 parent 2847524 commit 2d65454
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,31 @@ async def test_multi_mcu_sensor_data(hass, get_data, get_printer_objects_list):
)


async def test_multi_mcu_sensor_missing_data(hass, get_data, get_printer_objects_list):
"""Test."""
get_printer_objects_list["objects"].append("mcu Extruder")
get_data["status"]["mcu Extruder"] = {
"last_stats": None,
}

config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()

registry = get_entity_registry(hass)

assert (
registry.async_get_entity_id("sensor", DOMAIN, "test_mcu_Extruder_load")
is not None
)

assert (
registry.async_get_entity_id("sensor", DOMAIN, "test_mcu_Extruder_awake")
is not None
)


async def test_rounding_fan(hass, get_data):
"""Test."""
get_data["status"]["fan"]["speed"] = 0.33333333333
Expand Down

0 comments on commit 2d65454

Please sign in to comment.