def player_fixture(hass, state):
    """Get standard player."""
    player = ArcamFmj(MOCK_NAME, state, MOCK_UUID)
    player.entity_id = MOCK_ENTITY_ID
    player.hass = hass
    player.async_write_ha_state = Mock()
    return player
Exemple #2
0
def player_fixture(hass, state):
    """Get standard player."""
    player = ArcamFmj(state, MOCK_NAME, None)
    player.entity_id = MOCK_ENTITY_ID
    player.hass = hass
    player.async_schedule_update_ha_state = Mock()
    return player
async def test_supported_features_service(hass, state):
    """Test support when turn on service exist."""
    from homeassistant.components.arcam_fmj.media_player import ArcamFmj

    player = ArcamFmj(state, "dummy", MOCK_TURN_ON)
    player.hass = hass
    player.entity_id = MOCK_ENTITY_ID

    state.get_power.return_value = None
    data = await update(player)
    assert data.attributes["supported_features"] == 69004

    state.get_power.return_value = False
    data = await update(player)
    assert data.attributes["supported_features"] == 69004
async def test_turn_on_with_service(hass, state):
    """Test support when turn on service exist."""
    from homeassistant.components.arcam_fmj.media_player import ArcamFmj

    player = ArcamFmj(state, "dummy", MOCK_TURN_ON)
    player.hass = Mock(HomeAssistant)
    player.entity_id = MOCK_ENTITY_ID
    with patch(
        "homeassistant.components.arcam_fmj.media_player.async_call_from_config"
    ) as async_call_from_config:

        state.get_power.return_value = None
        await player.async_turn_on()
        state.set_power.assert_not_called()
        async_call_from_config.assert_called_with(
            player.hass,
            MOCK_TURN_ON,
            variables=None,
            blocking=True,
            validate_config=False,
        )
Exemple #5
0
def player_fixture(hass, state):
    """Get standard player."""
    player = ArcamFmj(state, MOCK_NAME, None)
    player.async_schedule_update_ha_state = Mock()
    return player