Files
core/tests/components/roku/__init__.py
Chris Talkington cf8dfdae47 Add config flow to roku (#31988)
* create a dedicated const.py

* add DEFAULT_PORT to const.py

* work on config flow conversion.

* remove discovery.

* work on config flow and add tests. other cleanup.

* work on config flow and add tests. other cleanup.

* add quality scale to manifest.

* work on config flow and add tests. other cleanup.

* review tweaks.

* Update manifest.json

* catch more specific errors

* catch more errors.

* impprt specific exceptions

* import specific exceptions

* Update __init__.py

* Update config_flow.py

* Update media_player.py

* Update remote.py

* Update media_player.py

* Update remote.py

* Update media_player.py

* Update remote.py

* Update config_flow.py

* Update config_flow.py

* Update media_player.py

* Update __init__.py

* Update __init__.py

* Update config_flow.py

* Update test_config_flow.py

* Update config_flow.py

* Update __init__.py

* Update test_config_flow.py

* Update remote.py

* Update test_init.py

* Update test_init.py

* Update media_player.py

* Update media_player.py

* Update media_player.py
2020-03-15 21:13:04 -07:00

51 lines
1.3 KiB
Python

"""Tests for the Roku component."""
from homeassistant.components.roku.const import DOMAIN
from homeassistant.const import CONF_HOST
from homeassistant.helpers.typing import HomeAssistantType
from tests.common import MockConfigEntry
HOST = "1.2.3.4"
NAME = "Roku 3"
SSDP_LOCATION = "http://1.2.3.4/"
UPNP_FRIENDLY_NAME = "My Roku 3"
UPNP_SERIAL = "1GU48T017973"
class MockDeviceInfo(object):
"""Mock DeviceInfo for Roku."""
model_name = NAME
model_num = "4200X"
software_version = "7.5.0.09021"
serial_num = UPNP_SERIAL
user_device_name = UPNP_FRIENDLY_NAME
roku_type = "Box"
def __repr__(self):
"""Return the object representation of DeviceInfo."""
return "<DeviceInfo: %s-%s, SW v%s, Ser# %s (%s)>" % (
self.model_name,
self.model_num,
self.software_version,
self.serial_num,
self.roku_type,
)
async def setup_integration(
hass: HomeAssistantType, skip_entry_setup: bool = False
) -> MockConfigEntry:
"""Set up the Roku integration in Home Assistant."""
entry = MockConfigEntry(
domain=DOMAIN, unique_id=UPNP_SERIAL, data={CONF_HOST: HOST}
)
entry.add_to_hass(hass)
if not skip_entry_setup:
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
return entry