Beispiel #1
0
async def test_abort_if_no_implementation_registered(hass):
    """Test we abort if no implementation is registered."""
    flow = config_flow.LogiCircleFlowHandler()
    flow.hass = hass

    result = await flow.async_step_user()
    assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
    assert result["reason"] == "missing_configuration"
Beispiel #2
0
def init_config_flow(hass):
    """Init a configuration flow."""
    config_flow.register_flow_implementation(hass,
                                             DOMAIN,
                                             client_id='id',
                                             client_secret='secret',
                                             api_key='123',
                                             redirect_uri='http://example.com',
                                             sensors=None)
    flow = config_flow.LogiCircleFlowHandler()
    flow._get_authorization_url = Mock(  # pylint: disable=W0212
        return_value='http://example.com')
    flow.hass = hass
    return flow
Beispiel #3
0
def init_config_flow(hass):
    """Init a configuration flow."""
    config_flow.register_flow_implementation(
        hass,
        DOMAIN,
        client_id="id",
        client_secret="secret",
        api_key="123",
        redirect_uri="http://example.com",
        sensors=None,
    )
    flow = config_flow.LogiCircleFlowHandler()
    flow._get_authorization_url = Mock(  # pylint: disable=protected-access
        return_value="http://example.com")
    flow.hass = hass
    return flow
Beispiel #4
0
async def test_gen_auth_url(hass, mock_logi_circle):  # pylint: disable=W0621
    """Test generating authorize URL from Logi Circle API."""
    config_flow.register_flow_implementation(hass,
                                             'test-auth-url',
                                             client_id='id',
                                             client_secret='secret',
                                             api_key='123',
                                             redirect_uri='http://example.com',
                                             sensors=None)
    flow = config_flow.LogiCircleFlowHandler()
    flow.hass = hass
    flow.flow_impl = 'test-auth-url'
    await async_setup_component(hass, 'http', {})

    result = flow._get_authorization_url()  # pylint: disable=W0212
    assert result == 'http://authorize.url'
Beispiel #5
0
async def test_gen_auth_url(hass, mock_logi_circle):  # pylint: disable=redefined-outer-name
    """Test generating authorize URL from Logi Circle API."""
    config_flow.register_flow_implementation(
        hass,
        "test-auth-url",
        client_id="id",
        client_secret="secret",
        api_key="123",
        redirect_uri="http://example.com",
        sensors=None,
    )
    flow = config_flow.LogiCircleFlowHandler()
    flow.hass = hass
    flow.flow_impl = "test-auth-url"
    await async_setup_component(hass, "http", {})

    result = flow._get_authorization_url()  # pylint: disable=protected-access
    assert result == "http://authorize.url"