Skip to content

Commit

Permalink
Move fixtures to decorators in netgear_lte tests (#119882)
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Jun 18, 2024
1 parent f5fd389 commit a1a8d38
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions tests/components/netgear_lte/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from unittest.mock import patch

from eternalegypt.eternalegypt import Error
import pytest
from syrupy.assertion import SnapshotAssertion

from homeassistant.components.netgear_lte.const import DOMAIN
Expand All @@ -18,7 +19,8 @@
from tests.common import async_fire_time_changed


async def test_setup_unload(hass: HomeAssistant, setup_integration: None) -> None:
@pytest.mark.usefixtures("setup_integration")
async def test_setup_unload(hass: HomeAssistant) -> None:
"""Test setup and unload."""
entry = hass.config_entries.async_entries(DOMAIN)[0]
assert entry.state is ConfigEntryState.LOADED
Expand All @@ -31,19 +33,18 @@ async def test_setup_unload(hass: HomeAssistant, setup_integration: None) -> Non
assert not hass.data.get(DOMAIN)


async def test_async_setup_entry_not_ready(
hass: HomeAssistant, setup_cannot_connect: None
) -> None:
@pytest.mark.usefixtures("setup_cannot_connect")
async def test_async_setup_entry_not_ready(hass: HomeAssistant) -> None:
"""Test that it throws ConfigEntryNotReady when exception occurs during setup."""
entry = hass.config_entries.async_entries(DOMAIN)[0]
assert len(hass.config_entries.async_entries(DOMAIN)) == 1
assert entry.state is ConfigEntryState.SETUP_RETRY


@pytest.mark.usefixtures("setup_integration")
async def test_device(
hass: HomeAssistant,
device_registry: dr.DeviceRegistry,
setup_integration: None,
snapshot: SnapshotAssertion,
) -> None:
"""Test device info."""
Expand All @@ -53,11 +54,8 @@ async def test_device(
assert device == snapshot


async def test_update_failed(
hass: HomeAssistant,
entity_registry_enabled_by_default: None,
setup_integration: None,
) -> None:
@pytest.mark.usefixtures("entity_registry_enabled_by_default", "setup_integration")
async def test_update_failed(hass: HomeAssistant) -> None:
"""Test coordinator throws UpdateFailed after failed update."""
with patch(
"homeassistant.components.netgear_lte.eternalegypt.Modem.information",
Expand Down

0 comments on commit a1a8d38

Please sign in to comment.