Improve type hints in locative tests (#123643)

This commit is contained in:
epenet 2024-08-12 21:55:44 +02:00 committed by GitHub
parent b0d1d7bdb2
commit 416d2fb82a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,7 +38,7 @@ async def locative_client(
@pytest.fixture @pytest.fixture
async def webhook_id(hass, locative_client): async def webhook_id(hass: HomeAssistant, locative_client: TestClient) -> str:
"""Initialize the Geofency component and get the webhook_id.""" """Initialize the Geofency component and get the webhook_id."""
await async_process_ha_core_config( await async_process_ha_core_config(
hass, hass,
@ -56,7 +56,7 @@ async def webhook_id(hass, locative_client):
return result["result"].data["webhook_id"] return result["result"].data["webhook_id"]
async def test_missing_data(locative_client, webhook_id) -> None: async def test_missing_data(locative_client: TestClient, webhook_id: str) -> None:
"""Test missing data.""" """Test missing data."""
url = f"/api/webhook/{webhook_id}" url = f"/api/webhook/{webhook_id}"
@ -116,7 +116,9 @@ async def test_missing_data(locative_client, webhook_id) -> None:
assert req.status == HTTPStatus.UNPROCESSABLE_ENTITY assert req.status == HTTPStatus.UNPROCESSABLE_ENTITY
async def test_enter_and_exit(hass: HomeAssistant, locative_client, webhook_id) -> None: async def test_enter_and_exit(
hass: HomeAssistant, locative_client: TestClient, webhook_id: str
) -> None:
"""Test when there is a known zone.""" """Test when there is a known zone."""
url = f"/api/webhook/{webhook_id}" url = f"/api/webhook/{webhook_id}"
@ -186,7 +188,7 @@ async def test_enter_and_exit(hass: HomeAssistant, locative_client, webhook_id)
async def test_exit_after_enter( async def test_exit_after_enter(
hass: HomeAssistant, locative_client, webhook_id hass: HomeAssistant, locative_client: TestClient, webhook_id: str
) -> None: ) -> None:
"""Test when an exit message comes after an enter message.""" """Test when an exit message comes after an enter message."""
url = f"/api/webhook/{webhook_id}" url = f"/api/webhook/{webhook_id}"
@ -229,7 +231,9 @@ async def test_exit_after_enter(
assert state.state == "work" assert state.state == "work"
async def test_exit_first(hass: HomeAssistant, locative_client, webhook_id) -> None: async def test_exit_first(
hass: HomeAssistant, locative_client: TestClient, webhook_id: str
) -> None:
"""Test when an exit message is sent first on a new device.""" """Test when an exit message is sent first on a new device."""
url = f"/api/webhook/{webhook_id}" url = f"/api/webhook/{webhook_id}"
@ -250,7 +254,9 @@ async def test_exit_first(hass: HomeAssistant, locative_client, webhook_id) -> N
assert state.state == "not_home" assert state.state == "not_home"
async def test_two_devices(hass: HomeAssistant, locative_client, webhook_id) -> None: async def test_two_devices(
hass: HomeAssistant, locative_client: TestClient, webhook_id: str
) -> None:
"""Test updating two different devices.""" """Test updating two different devices."""
url = f"/api/webhook/{webhook_id}" url = f"/api/webhook/{webhook_id}"
@ -294,7 +300,7 @@ async def test_two_devices(hass: HomeAssistant, locative_client, webhook_id) ->
reason="The device_tracker component does not support unloading yet." reason="The device_tracker component does not support unloading yet."
) )
async def test_load_unload_entry( async def test_load_unload_entry(
hass: HomeAssistant, locative_client, webhook_id hass: HomeAssistant, locative_client: TestClient, webhook_id: str
) -> None: ) -> None:
"""Test that the appropriate dispatch signals are added and removed.""" """Test that the appropriate dispatch signals are added and removed."""
url = f"/api/webhook/{webhook_id}" url = f"/api/webhook/{webhook_id}"