hass-core/tests/components/jvc_projector/conftest.py
Massimo Savazzi 2a5c85a020
Add JVC Projector Sensors ()
* Add JVC Projector Sensors - Power Status, Input

* Removed commented line, removed name in icons.json

* fixed icons.json file

* fixed tests

* Update homeassistant/components/jvc_projector/sensor.py

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* Fixed as requested

* Fixed code as requested

* added fixes

* Fixed sensor creation

* fixed const

* fixed icons

* Added test for both sensors

* Added ha state stest

* fixed commented line and removed useless ones

* Changed time FAST - SLOW to be more responsive

* Rolled back to previous values 6/60

* Update sensor.py

removed off

* Update icons.json

* Removed the Input Sensor entity

* Update tests/components/jvc_projector/test_sensor.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/jvc_projector/test_sensor.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/jvc_projector/test_sensor.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/jvc_projector/test_sensor.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/jvc_projector/test_sensor.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update tests/components/jvc_projector/test_sensor.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Updated unique id of sensor

Co-authored-by: Steve Easley <steve.easley@gmail.com>

* Added translation and string for Power Status

* Update homeassistant/components/jvc_projector/strings.json

Co-authored-by: Steve Easley <steve.easley@gmail.com>

* Update homeassistant/components/jvc_projector/strings.json

Co-authored-by: Steve Easley <steve.easley@gmail.com>

* Update strings.json

* Update strings.json

added missing ,

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Steve Easley <steve.easley@gmail.com>
2024-03-16 16:52:51 +01:00

58 lines
1.8 KiB
Python

"""Fixtures for JVC Projector integration."""
from collections.abc import Generator
from unittest.mock import AsyncMock, patch
import pytest
from homeassistant.components.jvc_projector.const import DOMAIN
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT
from homeassistant.core import HomeAssistant
from . import MOCK_HOST, MOCK_MAC, MOCK_MODEL, MOCK_PASSWORD, MOCK_PORT
from tests.common import MockConfigEntry
@pytest.fixture(name="mock_device")
def fixture_mock_device(request) -> Generator[None, AsyncMock, None]:
"""Return a mocked JVC Projector device."""
target = "homeassistant.components.jvc_projector.JvcProjector"
if hasattr(request, "param"):
target = request.param
with patch(target, autospec=True) as mock:
device = mock.return_value
device.host = MOCK_HOST
device.port = MOCK_PORT
device.mac = MOCK_MAC
device.model = MOCK_MODEL
device.get_state.return_value = {"power": "standby", "input": "hdmi1"}
yield device
@pytest.fixture(name="mock_config_entry")
def fixture_mock_config_entry() -> MockConfigEntry:
"""Return a mock config entry."""
return MockConfigEntry(
domain=DOMAIN,
unique_id=MOCK_MAC,
version=1,
data={
CONF_HOST: MOCK_HOST,
CONF_PORT: MOCK_PORT,
CONF_PASSWORD: MOCK_PASSWORD,
},
)
@pytest.fixture(name="mock_integration")
async def fixture_mock_integration(
hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
) -> MockConfigEntry:
"""Return a mock ConfigEntry setup for the integration."""
mock_config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(mock_config_entry.entry_id)
await hass.async_block_till_done()
return mock_config_entry