Register mobile_app notification services when a new device is added (#39356)

* Register mobile_app notification services when a new device is added

* targets and base service use their own patterns to generate the name
This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-08-28 12:18:02 -05:00
1 parent 4b8217777e
commit 3377f6b12a
3 files changed
+129 -52

No files matched your search

@@ -61,6 +61,35 @@ async def setup_push_receiver(hass, aioclient_mock):
await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
await hass.async_block_till_done()
loaded_late_entry = MockConfigEntry(
connection_class="cloud_push",
data={
"app_data": {"push_token": "PUSH_TOKEN2", "push_url": f"{push_url}2"},
"app_id": "io.homeassistant.mobile_app",
"app_name": "mobile_app tests",
"app_version": "1.0",
"device_id": "4d5e6f2",
"device_name": "Loaded Late",
"manufacturer": "Home Assistant",
"model": "mobile_app",
"os_name": "Linux",
"os_version": "5.0.6",
"secret": "123abc2",
"supports_encryption": False,
"user_id": "1a2b3c2",
"webhook_id": "webhook_id_2",
},
domain=DOMAIN,
source="registration",
title="mobile_app 2 test entry",
version=1,
)
loaded_late_entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(loaded_late_entry.entry_id)
await hass.async_block_till_done()
assert hass.services.has_service("notify", "mobile_app_loaded_late")
async def test_notify_works(hass, aioclient_mock, setup_push_receiver):
"""Test notify works."""