mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
Improve formatting in component test files (#135267)
Improve formatting in test files
This commit is contained in:
parent
9d1989125f
commit
02956f9a83
@ -99,9 +99,9 @@ async def test_services_remote(hass: HomeAssistant, config) -> None:
|
|||||||
"adb_shell",
|
"adb_shell",
|
||||||
{ATTR_COMMAND: ["BACK", "test"], ATTR_NUM_REPEATS: 2},
|
{ATTR_COMMAND: ["BACK", "test"], ATTR_NUM_REPEATS: 2},
|
||||||
[
|
[
|
||||||
f"input keyevent {KEYS["BACK"]}",
|
f"input keyevent {KEYS['BACK']}",
|
||||||
"test",
|
"test",
|
||||||
f"input keyevent {KEYS["BACK"]}",
|
f"input keyevent {KEYS['BACK']}",
|
||||||
"test",
|
"test",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -63,12 +63,12 @@ async def test_camera(
|
|||||||
assert camera_entity.image_source == "http://1.2.3.4:80/axis-cgi/jpg/image.cgi"
|
assert camera_entity.image_source == "http://1.2.3.4:80/axis-cgi/jpg/image.cgi"
|
||||||
assert (
|
assert (
|
||||||
camera_entity.mjpeg_source == "http://1.2.3.4:80/axis-cgi/mjpg/video.cgi"
|
camera_entity.mjpeg_source == "http://1.2.3.4:80/axis-cgi/mjpg/video.cgi"
|
||||||
f"{"" if not stream_profile else f"?{stream_profile}"}"
|
f"{'' if not stream_profile else f'?{stream_profile}'}"
|
||||||
)
|
)
|
||||||
assert (
|
assert (
|
||||||
await camera_entity.stream_source()
|
await camera_entity.stream_source()
|
||||||
== "rtsp://root:pass@1.2.3.4/axis-media/media.amp?videocodec=h264"
|
== "rtsp://root:pass@1.2.3.4/axis-media/media.amp?videocodec=h264"
|
||||||
f"{"" if not stream_profile else f"&{stream_profile}"}"
|
f"{'' if not stream_profile else f'&{stream_profile}'}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ async def test_async_initiate_backup(
|
|||||||
|
|
||||||
tar_file_path = str(mocked_tarfile.call_args_list[0][0][0])
|
tar_file_path = str(mocked_tarfile.call_args_list[0][0][0])
|
||||||
backup_directory = hass.config.path(backup_directory)
|
backup_directory = hass.config.path(backup_directory)
|
||||||
assert tar_file_path == f"{backup_directory}/{backup_data["backup_id"]}.tar"
|
assert tar_file_path == f"{backup_directory}/{backup_data['backup_id']}.tar"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("mock_backup_generation")
|
@pytest.mark.usefixtures("mock_backup_generation")
|
||||||
|
@ -92,7 +92,7 @@ async def test_slots_switch_setup_works(
|
|||||||
for slot, switch in enumerate(switches):
|
for slot, switch in enumerate(switches):
|
||||||
assert (
|
assert (
|
||||||
hass.states.get(switch.entity_id).attributes[ATTR_FRIENDLY_NAME]
|
hass.states.get(switch.entity_id).attributes[ATTR_FRIENDLY_NAME]
|
||||||
== f"{device.name} S{slot+1}"
|
== f"{device.name} S{slot + 1}"
|
||||||
)
|
)
|
||||||
assert hass.states.get(switch.entity_id).state == STATE_OFF
|
assert hass.states.get(switch.entity_id).state == STATE_OFF
|
||||||
assert mock_setup.api.auth.call_count == 1
|
assert mock_setup.api.auth.call_count == 1
|
||||||
|
@ -766,10 +766,7 @@ async def test_if_fires_on_position(
|
|||||||
]
|
]
|
||||||
) == sorted(
|
) == sorted(
|
||||||
[
|
[
|
||||||
(
|
f"is_pos_gt_45_lt_90 - device - {entry.entity_id} - closed - open - None",
|
||||||
f"is_pos_gt_45_lt_90 - device - {entry.entity_id} - closed - open"
|
|
||||||
" - None"
|
|
||||||
),
|
|
||||||
f"is_pos_lt_90 - device - {entry.entity_id} - closed - open - None",
|
f"is_pos_lt_90 - device - {entry.entity_id} - closed - open - None",
|
||||||
f"is_pos_gt_45 - device - {entry.entity_id} - open - closed - None",
|
f"is_pos_gt_45 - device - {entry.entity_id} - open - closed - None",
|
||||||
]
|
]
|
||||||
@ -925,10 +922,7 @@ async def test_if_fires_on_tilt_position(
|
|||||||
]
|
]
|
||||||
) == sorted(
|
) == sorted(
|
||||||
[
|
[
|
||||||
(
|
f"is_pos_gt_45_lt_90 - device - {entry.entity_id} - closed - open - None",
|
||||||
f"is_pos_gt_45_lt_90 - device - {entry.entity_id} - closed - open"
|
|
||||||
" - None"
|
|
||||||
),
|
|
||||||
f"is_pos_lt_90 - device - {entry.entity_id} - closed - open - None",
|
f"is_pos_lt_90 - device - {entry.entity_id} - closed - open - None",
|
||||||
f"is_pos_gt_45 - device - {entry.entity_id} - open - closed - None",
|
f"is_pos_gt_45 - device - {entry.entity_id} - open - closed - None",
|
||||||
]
|
]
|
||||||
|
@ -2208,7 +2208,7 @@ async def test_fan_speed_ordered(
|
|||||||
"ordered": True,
|
"ordered": True,
|
||||||
"speeds": [
|
"speeds": [
|
||||||
{
|
{
|
||||||
"speed_name": f"{idx+1}/{len(speeds)}",
|
"speed_name": f"{idx + 1}/{len(speeds)}",
|
||||||
"speed_values": [{"lang": "en", "speed_synonym": x}],
|
"speed_values": [{"lang": "en", "speed_synonym": x}],
|
||||||
}
|
}
|
||||||
for idx, x in enumerate(speeds)
|
for idx, x in enumerate(speeds)
|
||||||
|
@ -1770,8 +1770,7 @@ async def test_if_fires_on_entities_change_overlap_for_template(
|
|||||||
"entity_id": ["test.entity_1", "test.entity_2"],
|
"entity_id": ["test.entity_1", "test.entity_2"],
|
||||||
"above": above,
|
"above": above,
|
||||||
"below": below,
|
"below": below,
|
||||||
"for": '{{ 5 if trigger.entity_id == "test.entity_1"'
|
"for": '{{ 5 if trigger.entity_id == "test.entity_1" else 10 }}',
|
||||||
" else 10 }}",
|
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"service": "test.automation",
|
"service": "test.automation",
|
||||||
@ -1938,8 +1937,7 @@ async def test_variables_priority(
|
|||||||
"entity_id": ["test.entity_1", "test.entity_2"],
|
"entity_id": ["test.entity_1", "test.entity_2"],
|
||||||
"above": above,
|
"above": above,
|
||||||
"below": below,
|
"below": below,
|
||||||
"for": '{{ 5 if trigger.entity_id == "test.entity_1"'
|
"for": '{{ 5 if trigger.entity_id == "test.entity_1" else 10 }}',
|
||||||
" else 10 }}",
|
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"service": "test.automation",
|
"service": "test.automation",
|
||||||
|
@ -1423,8 +1423,7 @@ async def test_if_fires_on_entities_change_overlap_for_template(
|
|||||||
"platform": "state",
|
"platform": "state",
|
||||||
"entity_id": ["test.entity_1", "test.entity_2"],
|
"entity_id": ["test.entity_1", "test.entity_2"],
|
||||||
"to": "world",
|
"to": "world",
|
||||||
"for": '{{ 5 if trigger.entity_id == "test.entity_1"'
|
"for": '{{ 5 if trigger.entity_id == "test.entity_1" else 10 }}',
|
||||||
" else 10 }}",
|
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"service": "test.automation",
|
"service": "test.automation",
|
||||||
@ -1727,8 +1726,7 @@ async def test_variables_priority(
|
|||||||
"platform": "state",
|
"platform": "state",
|
||||||
"entity_id": ["test.entity_1", "test.entity_2"],
|
"entity_id": ["test.entity_1", "test.entity_2"],
|
||||||
"to": "world",
|
"to": "world",
|
||||||
"for": '{{ 5 if trigger.entity_id == "test.entity_1"'
|
"for": '{{ 5 if trigger.entity_id == "test.entity_1" else 10 }}',
|
||||||
" else 10 }}",
|
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"service": "test.automation",
|
"service": "test.automation",
|
||||||
|
@ -41,7 +41,7 @@ async def test_statistics_import(
|
|||||||
|
|
||||||
# Test that consumption statistics for 2 months have been added
|
# Test that consumption statistics for 2 months have been added
|
||||||
for entity in entities:
|
for entity in entities:
|
||||||
statistic_id = f"ista_ecotrend:{entity.entity_id.removeprefix("sensor.")}"
|
statistic_id = f"ista_ecotrend:{entity.entity_id.removeprefix('sensor.')}"
|
||||||
stats = await hass.async_add_executor_job(
|
stats = await hass.async_add_executor_job(
|
||||||
statistics_during_period,
|
statistics_during_period,
|
||||||
hass,
|
hass,
|
||||||
@ -70,7 +70,7 @@ async def test_statistics_import(
|
|||||||
await async_wait_recording_done(hass)
|
await async_wait_recording_done(hass)
|
||||||
|
|
||||||
for entity in entities:
|
for entity in entities:
|
||||||
statistic_id = f"ista_ecotrend:{entity.entity_id.removeprefix("sensor.")}"
|
statistic_id = f"ista_ecotrend:{entity.entity_id.removeprefix('sensor.')}"
|
||||||
stats = await hass.async_add_executor_job(
|
stats = await hass.async_add_executor_job(
|
||||||
statistics_during_period,
|
statistics_during_period,
|
||||||
hass,
|
hass,
|
||||||
|
@ -281,7 +281,7 @@ async def test_import_from_yaml_fails(
|
|||||||
assert not hass.states.get("camera.config_test")
|
assert not hass.states.get("camera.config_test")
|
||||||
|
|
||||||
issue = issue_registry.async_get_issue(
|
issue = issue_registry.async_get_issue(
|
||||||
DOMAIN, f"no_access_path_{slugify("mock.file")}"
|
DOMAIN, f"no_access_path_{slugify('mock.file')}"
|
||||||
)
|
)
|
||||||
assert issue
|
assert issue
|
||||||
assert issue.translation_key == "no_access_path"
|
assert issue.translation_key == "no_access_path"
|
||||||
|
@ -152,8 +152,7 @@ async def test_get_image_http(
|
|||||||
client = await hass_client_no_auth()
|
client = await hass_client_no_auth()
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"homeassistant.components.media_player.MediaPlayerEntity."
|
"homeassistant.components.media_player.MediaPlayerEntity.async_get_media_image",
|
||||||
"async_get_media_image",
|
|
||||||
return_value=(b"image", "image/jpeg"),
|
return_value=(b"image", "image/jpeg"),
|
||||||
):
|
):
|
||||||
resp = await client.get(state.attributes["entity_picture"])
|
resp = await client.get(state.attributes["entity_picture"])
|
||||||
|
@ -422,9 +422,9 @@ async def test_virtual_binary_sensor(
|
|||||||
assert hass.states.get(ENTITY_ID).state == expected
|
assert hass.states.get(ENTITY_ID).state == expected
|
||||||
|
|
||||||
for i, slave in enumerate(slaves):
|
for i, slave in enumerate(slaves):
|
||||||
entity_id = f"{SENSOR_DOMAIN}.{TEST_ENTITY_NAME}_{i+1}".replace(" ", "_")
|
entity_id = f"{SENSOR_DOMAIN}.{TEST_ENTITY_NAME}_{i + 1}".replace(" ", "_")
|
||||||
assert hass.states.get(entity_id).state == slave
|
assert hass.states.get(entity_id).state == slave
|
||||||
unique_id = f"{SLAVE_UNIQUE_ID}_{i+1}"
|
unique_id = f"{SLAVE_UNIQUE_ID}_{i + 1}"
|
||||||
entry = entity_registry.async_get(entity_id)
|
entry = entity_registry.async_get(entity_id)
|
||||||
assert entry.unique_id == unique_id
|
assert entry.unique_id == unique_id
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ from homeassistant.helpers import entity_registry as er
|
|||||||
from tests.common import MockConfigEntry
|
from tests.common import MockConfigEntry
|
||||||
|
|
||||||
TEST_CONFIG_ENTRY_ID = "74565ad414754616000674c87bdc876c"
|
TEST_CONFIG_ENTRY_ID = "74565ad414754616000674c87bdc876c"
|
||||||
TEST_URL = f"http://test:{DEFAULT_PORT+1}"
|
TEST_URL = f"http://test:{DEFAULT_PORT + 1}"
|
||||||
TEST_CAMERA_ID = 100
|
TEST_CAMERA_ID = 100
|
||||||
TEST_CAMERA_NAME = "Test Camera"
|
TEST_CAMERA_NAME = "Test Camera"
|
||||||
TEST_CAMERA_ENTITY_ID = "camera.test_camera"
|
TEST_CAMERA_ENTITY_ID = "camera.test_camera"
|
||||||
|
@ -356,7 +356,7 @@ async def test_invalid_device_discovery_config(
|
|||||||
async_fire_mqtt_message(
|
async_fire_mqtt_message(
|
||||||
hass,
|
hass,
|
||||||
"homeassistant/device/bla/config",
|
"homeassistant/device/bla/config",
|
||||||
'{ "o": {"name": "foobar"}, "dev": {"identifiers": ["ABDE03"]}, ' '"cmps": ""}',
|
'{ "o": {"name": "foobar"}, "dev": {"identifiers": ["ABDE03"]}, "cmps": ""}',
|
||||||
)
|
)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
assert (
|
assert (
|
||||||
|
@ -179,4 +179,4 @@ class MyStromSwitchMock(MyStromDeviceMock):
|
|||||||
"""Return the URI."""
|
"""Return the URI."""
|
||||||
if not self._requested_state:
|
if not self._requested_state:
|
||||||
return None
|
return None
|
||||||
return f"http://{self._state["ip"]}"
|
return f"http://{self._state['ip']}"
|
||||||
|
@ -341,7 +341,7 @@ async def test_message_history_trimming(
|
|||||||
for i in range(5):
|
for i in range(5):
|
||||||
result = await conversation.async_converse(
|
result = await conversation.async_converse(
|
||||||
hass,
|
hass,
|
||||||
f"message {i+1}",
|
f"message {i + 1}",
|
||||||
conversation_id="1234",
|
conversation_id="1234",
|
||||||
context=Context(),
|
context=Context(),
|
||||||
agent_id=mock_config_entry.entry_id,
|
agent_id=mock_config_entry.entry_id,
|
||||||
@ -432,7 +432,7 @@ async def test_message_history_pruning(
|
|||||||
for i in range(3):
|
for i in range(3):
|
||||||
result = await conversation.async_converse(
|
result = await conversation.async_converse(
|
||||||
hass,
|
hass,
|
||||||
f"message {i+1}",
|
f"message {i + 1}",
|
||||||
conversation_id=None,
|
conversation_id=None,
|
||||||
context=Context(),
|
context=Context(),
|
||||||
agent_id=mock_config_entry.entry_id,
|
agent_id=mock_config_entry.entry_id,
|
||||||
@ -490,7 +490,7 @@ async def test_message_history_unlimited(
|
|||||||
for i in range(100):
|
for i in range(100):
|
||||||
result = await conversation.async_converse(
|
result = await conversation.async_converse(
|
||||||
hass,
|
hass,
|
||||||
f"message {i+1}",
|
f"message {i + 1}",
|
||||||
conversation_id=conversation_id,
|
conversation_id=conversation_id,
|
||||||
context=Context(),
|
context=Context(),
|
||||||
agent_id=mock_config_entry.entry_id,
|
agent_id=mock_config_entry.entry_id,
|
||||||
|
@ -830,7 +830,9 @@ async def test_hassio_discovery_flow_new_port_missing_unique_id(
|
|||||||
# Setup the config entry
|
# Setup the config entry
|
||||||
config_entry = MockConfigEntry(
|
config_entry = MockConfigEntry(
|
||||||
data={
|
data={
|
||||||
"url": f"http://{HASSIO_DATA.config['host']}:{HASSIO_DATA.config['port']+1}"
|
"url": (
|
||||||
|
f"http://{HASSIO_DATA.config['host']}:{HASSIO_DATA.config['port'] + 1}"
|
||||||
|
)
|
||||||
},
|
},
|
||||||
domain=otbr.DOMAIN,
|
domain=otbr.DOMAIN,
|
||||||
options={},
|
options={},
|
||||||
@ -861,7 +863,9 @@ async def test_hassio_discovery_flow_new_port(hass: HomeAssistant) -> None:
|
|||||||
# Setup the config entry
|
# Setup the config entry
|
||||||
config_entry = MockConfigEntry(
|
config_entry = MockConfigEntry(
|
||||||
data={
|
data={
|
||||||
"url": f"http://{HASSIO_DATA.config['host']}:{HASSIO_DATA.config['port']+1}"
|
"url": (
|
||||||
|
f"http://{HASSIO_DATA.config['host']}:{HASSIO_DATA.config['port'] + 1}"
|
||||||
|
)
|
||||||
},
|
},
|
||||||
domain=otbr.DOMAIN,
|
domain=otbr.DOMAIN,
|
||||||
options={},
|
options={},
|
||||||
@ -897,7 +901,9 @@ async def test_hassio_discovery_flow_new_port_other_addon(hass: HomeAssistant) -
|
|||||||
|
|
||||||
# Setup the config entry
|
# Setup the config entry
|
||||||
config_entry = MockConfigEntry(
|
config_entry = MockConfigEntry(
|
||||||
data={"url": f"http://openthread_border_router:{HASSIO_DATA.config['port']+1}"},
|
data={
|
||||||
|
"url": f"http://openthread_border_router:{HASSIO_DATA.config['port'] + 1}"
|
||||||
|
},
|
||||||
domain=otbr.DOMAIN,
|
domain=otbr.DOMAIN,
|
||||||
options={},
|
options={},
|
||||||
source="hassio",
|
source="hassio",
|
||||||
@ -914,7 +920,7 @@ async def test_hassio_discovery_flow_new_port_other_addon(hass: HomeAssistant) -
|
|||||||
|
|
||||||
# Make sure the data of the existing entry was not updated
|
# Make sure the data of the existing entry was not updated
|
||||||
expected_data = {
|
expected_data = {
|
||||||
"url": f"http://openthread_border_router:{HASSIO_DATA.config['port']+1}",
|
"url": f"http://openthread_border_router:{HASSIO_DATA.config['port'] + 1}",
|
||||||
}
|
}
|
||||||
config_entry = hass.config_entries.async_get_entry(config_entry.entry_id)
|
config_entry = hass.config_entries.async_get_entry(config_entry.entry_id)
|
||||||
assert config_entry.data == expected_data
|
assert config_entry.data == expected_data
|
||||||
|
@ -523,7 +523,7 @@ async def test_callback_view(
|
|||||||
assert result["type"] is FlowResultType.EXTERNAL_STEP
|
assert result["type"] is FlowResultType.EXTERNAL_STEP
|
||||||
|
|
||||||
client = await hass_client_no_auth()
|
client = await hass_client_no_auth()
|
||||||
forward_url = f'{config_flow.AUTH_CALLBACK_PATH}?flow_id={result["flow_id"]}'
|
forward_url = f"{config_flow.AUTH_CALLBACK_PATH}?flow_id={result['flow_id']}"
|
||||||
|
|
||||||
resp = await client.get(forward_url)
|
resp = await client.get(forward_url)
|
||||||
assert resp.status == HTTPStatus.OK
|
assert resp.status == HTTPStatus.OK
|
||||||
|
@ -541,8 +541,7 @@ async def test_view_empty_namespace(
|
|||||||
|
|
||||||
assert "# HELP python_info Python platform information" in body
|
assert "# HELP python_info Python platform information" in body
|
||||||
assert (
|
assert (
|
||||||
"# HELP python_gc_objects_collected_total "
|
"# HELP python_gc_objects_collected_total Objects collected during gc" in body
|
||||||
"Objects collected during gc" in body
|
|
||||||
)
|
)
|
||||||
|
|
||||||
EntityMetric(
|
EntityMetric(
|
||||||
@ -569,8 +568,7 @@ async def test_view_default_namespace(
|
|||||||
|
|
||||||
assert "# HELP python_info Python platform information" in body
|
assert "# HELP python_info Python platform information" in body
|
||||||
assert (
|
assert (
|
||||||
"# HELP python_gc_objects_collected_total "
|
"# HELP python_gc_objects_collected_total Objects collected during gc" in body
|
||||||
"Objects collected during gc" in body
|
|
||||||
)
|
)
|
||||||
|
|
||||||
EntityMetric(
|
EntityMetric(
|
||||||
|
@ -2655,9 +2655,9 @@ async def test_setup_fails_after_downgrade(
|
|||||||
await hass.async_stop()
|
await hass.async_stop()
|
||||||
assert instance.engine is None
|
assert instance.engine is None
|
||||||
assert (
|
assert (
|
||||||
f"The database schema version {SCHEMA_VERSION+1} is newer than {SCHEMA_VERSION}"
|
f"The database schema version {SCHEMA_VERSION + 1} is newer "
|
||||||
" which is the maximum database schema version supported by the installed "
|
f"than {SCHEMA_VERSION} which is the maximum database schema "
|
||||||
"version of Home Assistant Core"
|
"version supported by the installed version of Home Assistant Core"
|
||||||
) in caplog.text
|
) in caplog.text
|
||||||
|
|
||||||
|
|
||||||
|
@ -1514,7 +1514,7 @@ async def _test_split_light(
|
|||||||
await common.async_turn_on(hass, entity)
|
await common.async_turn_on(hass, entity)
|
||||||
mqtt_mock.async_publish.assert_called_once_with(
|
mqtt_mock.async_publish.assert_called_once_with(
|
||||||
"tasmota_49A3BC/cmnd/Backlog",
|
"tasmota_49A3BC/cmnd/Backlog",
|
||||||
f"NoDelay;Power{idx+num_switches+1} ON",
|
f"NoDelay;Power{idx + num_switches + 1} ON",
|
||||||
0,
|
0,
|
||||||
False,
|
False,
|
||||||
)
|
)
|
||||||
@ -1524,7 +1524,7 @@ async def _test_split_light(
|
|||||||
await common.async_turn_on(hass, entity, brightness=(idx + 1) * 25.5)
|
await common.async_turn_on(hass, entity, brightness=(idx + 1) * 25.5)
|
||||||
mqtt_mock.async_publish.assert_called_once_with(
|
mqtt_mock.async_publish.assert_called_once_with(
|
||||||
"tasmota_49A3BC/cmnd/Backlog",
|
"tasmota_49A3BC/cmnd/Backlog",
|
||||||
f"NoDelay;Channel{idx+num_switches+1} {(idx+1)*10}",
|
f"NoDelay;Channel{idx + num_switches + 1} {(idx + 1) * 10}",
|
||||||
0,
|
0,
|
||||||
False,
|
False,
|
||||||
)
|
)
|
||||||
@ -1595,7 +1595,7 @@ async def _test_unlinked_light(
|
|||||||
await common.async_turn_on(hass, entity)
|
await common.async_turn_on(hass, entity)
|
||||||
mqtt_mock.async_publish.assert_called_once_with(
|
mqtt_mock.async_publish.assert_called_once_with(
|
||||||
"tasmota_49A3BC/cmnd/Backlog",
|
"tasmota_49A3BC/cmnd/Backlog",
|
||||||
f"NoDelay;Power{idx+num_switches+1} ON",
|
f"NoDelay;Power{idx + num_switches + 1} ON",
|
||||||
0,
|
0,
|
||||||
False,
|
False,
|
||||||
)
|
)
|
||||||
@ -1605,7 +1605,7 @@ async def _test_unlinked_light(
|
|||||||
await common.async_turn_on(hass, entity, brightness=(idx + 1) * 25.5)
|
await common.async_turn_on(hass, entity, brightness=(idx + 1) * 25.5)
|
||||||
mqtt_mock.async_publish.assert_called_once_with(
|
mqtt_mock.async_publish.assert_called_once_with(
|
||||||
"tasmota_49A3BC/cmnd/Backlog",
|
"tasmota_49A3BC/cmnd/Backlog",
|
||||||
f"NoDelay;Dimmer{idx+1} {(idx+1)*10}",
|
f"NoDelay;Dimmer{idx + 1} {(idx + 1) * 10}",
|
||||||
0,
|
0,
|
||||||
False,
|
False,
|
||||||
)
|
)
|
||||||
|
@ -112,4 +112,4 @@ async def test_errors(hass: HomeAssistant) -> None:
|
|||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
mock_set.assert_called_once()
|
mock_set.assert_called_once()
|
||||||
assert str(error.value) == f"Command failed, {TEST_RESPONSE_ERROR["reason"]}"
|
assert str(error.value) == f"Command failed, {TEST_RESPONSE_ERROR['reason']}"
|
||||||
|
@ -501,7 +501,7 @@ async def test_unlink_devices(
|
|||||||
|
|
||||||
# Generate list of test identifiers
|
# Generate list of test identifiers
|
||||||
test_identifiers = [
|
test_identifiers = [
|
||||||
(domain, f"{device_id}{"" if i == 0 else f"_000{i}"}")
|
(domain, f"{device_id}{'' if i == 0 else f'_000{i}'}")
|
||||||
for i in range(id_count)
|
for i in range(id_count)
|
||||||
for domain in domains
|
for domain in domains
|
||||||
]
|
]
|
||||||
|
@ -262,7 +262,7 @@ async def test_device_button_entities(
|
|||||||
WLAN_REGENERATE_PASSWORD,
|
WLAN_REGENERATE_PASSWORD,
|
||||||
"button.ssid_1_regenerate_password",
|
"button.ssid_1_regenerate_password",
|
||||||
"put",
|
"put",
|
||||||
f"/rest/wlanconf/{WLAN_REGENERATE_PASSWORD[0]["_id"]}",
|
f"/rest/wlanconf/{WLAN_REGENERATE_PASSWORD[0]['_id']}",
|
||||||
{
|
{
|
||||||
"json": {"data": "password changed successfully", "meta": {"rc": "ok"}},
|
"json": {"data": "password changed successfully", "meta": {"rc": "ok"}},
|
||||||
"headers": {"content-type": CONTENT_TYPE_JSON},
|
"headers": {"content-type": CONTENT_TYPE_JSON},
|
||||||
|
@ -589,14 +589,14 @@ async def test_restoring_client(
|
|||||||
entity_registry.async_get_or_create( # Make sure unique ID converts to site_id-mac
|
entity_registry.async_get_or_create( # Make sure unique ID converts to site_id-mac
|
||||||
TRACKER_DOMAIN,
|
TRACKER_DOMAIN,
|
||||||
UNIFI_DOMAIN,
|
UNIFI_DOMAIN,
|
||||||
f'{clients_all_payload[0]["mac"]}-site_id',
|
f"{clients_all_payload[0]['mac']}-site_id",
|
||||||
suggested_object_id=clients_all_payload[0]["hostname"],
|
suggested_object_id=clients_all_payload[0]["hostname"],
|
||||||
config_entry=config_entry,
|
config_entry=config_entry,
|
||||||
)
|
)
|
||||||
entity_registry.async_get_or_create( # Unique ID already follow format site_id-mac
|
entity_registry.async_get_or_create( # Unique ID already follow format site_id-mac
|
||||||
TRACKER_DOMAIN,
|
TRACKER_DOMAIN,
|
||||||
UNIFI_DOMAIN,
|
UNIFI_DOMAIN,
|
||||||
f'site_id-{client_payload[0]["mac"]}',
|
f"site_id-{client_payload[0]['mac']}",
|
||||||
suggested_object_id=client_payload[0]["hostname"],
|
suggested_object_id=client_payload[0]["hostname"],
|
||||||
config_entry=config_entry,
|
config_entry=config_entry,
|
||||||
)
|
)
|
||||||
|
@ -1577,14 +1577,14 @@ async def test_updating_unique_id(
|
|||||||
entity_registry.async_get_or_create(
|
entity_registry.async_get_or_create(
|
||||||
SWITCH_DOMAIN,
|
SWITCH_DOMAIN,
|
||||||
UNIFI_DOMAIN,
|
UNIFI_DOMAIN,
|
||||||
f'{device_payload[0]["mac"]}-outlet-1',
|
f"{device_payload[0]['mac']}-outlet-1",
|
||||||
suggested_object_id="plug_outlet_1",
|
suggested_object_id="plug_outlet_1",
|
||||||
config_entry=config_entry,
|
config_entry=config_entry,
|
||||||
)
|
)
|
||||||
entity_registry.async_get_or_create(
|
entity_registry.async_get_or_create(
|
||||||
SWITCH_DOMAIN,
|
SWITCH_DOMAIN,
|
||||||
UNIFI_DOMAIN,
|
UNIFI_DOMAIN,
|
||||||
f'{device_payload[1]["mac"]}-poe-1',
|
f"{device_payload[1]['mac']}-poe-1",
|
||||||
suggested_object_id="switch_port_1_poe",
|
suggested_object_id="switch_port_1_poe",
|
||||||
config_entry=config_entry,
|
config_entry=config_entry,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user