From 71cf34218860f1508fbca9246261b1e378785ed8 Mon Sep 17 00:00:00 2001 From: Joe Hansche Date: Sat, 11 Jan 2025 11:22:48 -0500 Subject: [PATCH] Update tests --- requirements.test.txt | 3 ++- tests/test_device_trigger.py | 6 ++---- tests/test_init.py | 9 +++------ 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/requirements.test.txt b/requirements.test.txt index dffff28..50ca4ce 100644 --- a/requirements.test.txt +++ b/requirements.test.txt @@ -17,4 +17,5 @@ pytest-cov pytest-aiohttp pytest-asyncio pytest-unordered -py==1.10.0 # Fixes pytest-sugar 0.9.5 +py +propcache diff --git a/tests/test_device_trigger.py b/tests/test_device_trigger.py index 08e7143..ad795e5 100644 --- a/tests/test_device_trigger.py +++ b/tests/test_device_trigger.py @@ -105,9 +105,8 @@ async def test_does_not_fire_on_postcard_event_for_other_feeder(hass, calls): async def test_config_schema(hass, device_reg): """Test we get the expected triggers from a birdbuddy.""" - config_entry = MockConfigEntry(domain="birdbuddy", data={}) + config_entry = MockConfigEntry(domain="birdbuddy", data={}, state=ConfigEntryState.LOADED) config_entry.add_to_hass(hass) - config_entry.state = ConfigEntryState.LOADED device_entry = device_reg.async_get_or_create( config_entry_id=config_entry.entry_id, identifiers={(DOMAIN, "feeder1")}, @@ -125,9 +124,8 @@ async def test_config_schema(hass, device_reg): async def test_config_schema_no_coordinator(hass, device_reg): """Test we get the expected triggers from a birdbuddy.""" - config_entry = MockConfigEntry(domain="birdbuddy", data={}) + config_entry = MockConfigEntry(domain="birdbuddy", data={}, state=ConfigEntryState.LOADED) config_entry.add_to_hass(hass) - config_entry.state = ConfigEntryState.LOADED device_entry = device_reg.async_get_or_create( config_entry_id=config_entry.entry_id, identifiers={(DOMAIN, "feeder1")}, diff --git a/tests/test_init.py b/tests/test_init.py index dbecc0a..b5928a0 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -21,9 +21,8 @@ async def test_setup_entry(hass: HomeAssistant): "email": "test@email.com", "password": "test-password", } - config_entry = MockConfigEntry(domain="birdbuddy", data=config) + config_entry = MockConfigEntry(domain="birdbuddy", data=config, state=ConfigEntryState.NOT_LOADED) config_entry.add_to_hass(hass) - config_entry.state = ConfigEntryState.NOT_LOADED with patch( "birdbuddy.client.BirdBuddy.refresh", @@ -44,9 +43,8 @@ async def test_setup_entry_no_feeders(hass: HomeAssistant): "email": "test@email.com", "password": "test-password", } - config_entry = MockConfigEntry(domain="birdbuddy", data=config) + config_entry = MockConfigEntry(domain="birdbuddy", data=config, state=ConfigEntryState.NOT_LOADED) config_entry.add_to_hass(hass) - config_entry.state = ConfigEntryState.NOT_LOADED with patch( "birdbuddy.client.BirdBuddy.refresh", @@ -64,9 +62,8 @@ async def test_setup_entry_refresh_fails(hass: HomeAssistant): "email": "test@email.com", "password": "test-password", } - config_entry = MockConfigEntry(domain="birdbuddy", data=config) + config_entry = MockConfigEntry(domain="birdbuddy", data=config, state=ConfigEntryState.NOT_LOADED) config_entry.add_to_hass(hass) - config_entry.state = ConfigEntryState.NOT_LOADED with patch( "birdbuddy.client.BirdBuddy.refresh",