Skip to content

Commit

Permalink
WIP: add test for probe
Browse files Browse the repository at this point in the history
  • Loading branch information
hannut committed Dec 9, 2024
1 parent 8a9fb2d commit 11f4125
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ def get_data_fixture():
"speed": 0.1234,
"rpm": 4500,
},
"temperature_probe eddy_temp": {
"temperature": 32.43,
},
"temperature_host host_temp": {
"temperature": 32.43,
},
Expand Down Expand Up @@ -293,6 +296,7 @@ def get_printer_objects_list_fixture():
"bed_mesh",
"screws_tilt_adjust",
"temperature_sensor mcu_temp",
"temperature_probe eddy_temp",
"stepper_enable",
"motion_report",
"query_endstops",
Expand Down
15 changes: 15 additions & 0 deletions tests/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ async def test_sensor_services_update(hass, get_data):
"sensor, value",
[
("mainsail_mcu_temp", "32.43"),
("mainsail_eddy_temp", "32.43"),
("mainsail_bed_target", "60.0"),
("mainsail_bed_temperature", "60.01"),
("mainsail_extruder_target", "205.0"),
Expand Down Expand Up @@ -215,6 +216,20 @@ async def test_opt_sensor_missing(hass, get_data, get_printer_objects_list):
assert state is None


async def test_opt_probe_missing(hass, get_data, get_printer_objects_list):
"""Test."""
get_data["status"].pop("temperature_probe eddy_temp", None)
get_printer_objects_list["objects"].remove("temperature_probe eddy_temp")

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()

state = hass.states.get("sensor.mainsail_eddy_temp")
assert state is None


async def test_eta(hass):
"""Test."""
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG, entry_id="test")
Expand Down

0 comments on commit 11f4125

Please sign in to comment.