Example #1
0
def mock_cloudhooks(hass):
    """Mock cloudhooks class."""
    cloud = Mock()
    cloud.hass = hass
    cloud.hass.async_add_executor_job = Mock(return_value=mock_coro())
    cloud.iot = Mock(async_send_message=Mock(return_value=mock_coro()))
    cloud.cloudhook_create_url = 'https://webhook-create.url'
    cloud.prefs = prefs.CloudPreferences(hass)
    hass.loop.run_until_complete(cloud.prefs.async_initialize())
    return cloudhooks.Cloudhooks(cloud)
Example #2
0
async def cloud_prefs(hass):
    """Fixture for cloud preferences."""
    cloud_prefs = prefs.CloudPreferences(hass)
    await cloud_prefs.async_initialize()
    return cloud_prefs