From 4329a47ef80ee2703deb81297c5d694531564bb2 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 10 Aug 2023 18:23:13 +0200 Subject: [PATCH] Adjust google_generative_ai_conversation tests which create devices (#98192) --- .../test_init.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/components/google_generative_ai_conversation/test_init.py b/tests/components/google_generative_ai_conversation/test_init.py index e8da4cf3920..982f3993e04 100644 --- a/tests/components/google_generative_ai_conversation/test_init.py +++ b/tests/components/google_generative_ai_conversation/test_init.py @@ -20,11 +20,13 @@ async def test_default_prompt( snapshot: SnapshotAssertion, ) -> None: """Test that the default prompt works.""" + entry = MockConfigEntry(title=None) + entry.add_to_hass(hass) for i in range(3): area_registry.async_create(f"{i}Empty Area") device_registry.async_get_or_create( - config_entry_id="1234", + config_entry_id=entry.entry_id, connections={("test", "1234")}, name="Test Device", manufacturer="Test Manufacturer", @@ -33,7 +35,7 @@ async def test_default_prompt( ) for i in range(3): device_registry.async_get_or_create( - config_entry_id="1234", + config_entry_id=entry.entry_id, connections={("test", f"{i}abcd")}, name="Test Service", manufacturer="Test Manufacturer", @@ -42,7 +44,7 @@ async def test_default_prompt( entry_type=dr.DeviceEntryType.SERVICE, ) device_registry.async_get_or_create( - config_entry_id="1234", + config_entry_id=entry.entry_id, connections={("test", "5678")}, name="Test Device 2", manufacturer="Test Manufacturer 2", @@ -50,7 +52,7 @@ async def test_default_prompt( suggested_area="Test Area 2", ) device_registry.async_get_or_create( - config_entry_id="1234", + config_entry_id=entry.entry_id, connections={("test", "9876")}, name="Test Device 3", manufacturer="Test Manufacturer 3", @@ -58,13 +60,13 @@ async def test_default_prompt( suggested_area="Test Area 2", ) device_registry.async_get_or_create( - config_entry_id="1234", + config_entry_id=entry.entry_id, connections={("test", "qwer")}, name="Test Device 4", suggested_area="Test Area 2", ) device = device_registry.async_get_or_create( - config_entry_id="1234", + config_entry_id=entry.entry_id, connections={("test", "9876-disabled")}, name="Test Device 3", manufacturer="Test Manufacturer 3", @@ -75,14 +77,14 @@ async def test_default_prompt( device.id, disabled_by=dr.DeviceEntryDisabler.USER ) device_registry.async_get_or_create( - config_entry_id="1234", + config_entry_id=entry.entry_id, connections={("test", "9876-no-name")}, manufacturer="Test Manufacturer NoName", model="Test Model NoName", suggested_area="Test Area 2", ) device_registry.async_get_or_create( - config_entry_id="1234", + config_entry_id=entry.entry_id, connections={("test", "9876-integer-values")}, name=1, manufacturer=2,