示例#1
0
async def test_component_wrapper(hass):
    """Test component wrapper."""
    calls = async_mock_service(hass, "persistent_notification", "create")

    components = loader.Components(hass)
    components.persistent_notification.async_create("message")
    await hass.async_block_till_done()

    assert len(calls) == 1
示例#2
0
def test_component_wrapper(hass):
    """Test component wrapper."""
    calls = async_mock_service(hass, 'light', 'turn_on')

    components = loader.Components(hass)
    components.light.async_turn_on('light.test')
    yield from hass.async_block_till_done()

    assert len(calls) == 1
示例#3
0
def test_component_wrapper(hass):
    """Test component wrapper."""
    calls = async_mock_service(hass, 'persistent_notification', 'create')

    components = loader.Components(hass)
    components.persistent_notification.async_create('message')
    yield from hass.async_block_till_done()

    assert len(calls) == 1
示例#4
0
def test_component_loader_non_existing(hass):
    """Test loading components."""
    components = loader.Components(hass)
    with pytest.raises(ImportError):
        components.non_existing
示例#5
0
def test_component_loader(hass):
    """Test loading components."""
    components = loader.Components(hass)
    assert components.http.CONFIG_SCHEMA is http.CONFIG_SCHEMA
    assert hass.components.http.CONFIG_SCHEMA is http.CONFIG_SCHEMA
示例#6
0
async def test_component_wrapper(hass):
    """Test component wrapper."""
    components = loader.Components(hass)
    components.persistent_notification.async_create("message")

    assert len(hass.states.async_entity_ids("persistent_notification")) == 1