Use async_load_fixture in async test functions (l-z) (#145717)

* Use async_load_fixture in async test functions (l-z)

* Adjust
This commit is contained in:
epenet
2025-06-01 06:29:17 -07:00
committed by GitHub
parent b318644998
commit a007e8dc26
46 changed files with 426 additions and 299 deletions
@@ -14,14 +14,16 @@ from homeassistant.data_entry_flow import FlowResultType
from . import MOCK_FAILED_TO_LOGIN_MSG, MOCK_INVALID_TOKEN_MGS
from tests.common import MockConfigEntry, load_fixture
from tests.common import MockConfigEntry, async_load_fixture
@pytest.mark.parametrize("test_cucode_in_coordinator_data", [False, True])
async def test_form(hass: HomeAssistant, test_cucode_in_coordinator_data) -> None:
"""Test we get the form."""
coordinator_data = json.loads(load_fixture("switchbee.json", "switchbee"))
coordinator_data = json.loads(
await async_load_fixture(hass, "switchbee.json", DOMAIN)
)
if test_cucode_in_coordinator_data:
coordinator_data["data"]["cuCode"] = "300F123456"
@@ -138,7 +140,9 @@ async def test_form_unknown_error(hass: HomeAssistant) -> None:
async def test_form_entry_exists(hass: HomeAssistant) -> None:
"""Test we handle an already existing entry."""
coordinator_data = json.loads(load_fixture("switchbee.json", "switchbee"))
coordinator_data = json.loads(
await async_load_fixture(hass, "switchbee.json", DOMAIN)
)
MockConfigEntry(
unique_id="a8:21:08:e7:67:b6",
domain=DOMAIN,