Update vizio dependency and integration name (#31975)

* bump pyvizio version and clean up code

* fix requirements

* update parameter to optional per review in docs PR
This commit is contained in:
Raman Gupta 2020-02-20 11:43:29 -05:00 committed by GitHub
parent 51b2d0b4f8
commit 7a6b13cb0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 46 additions and 27 deletions

View file

@ -97,7 +97,7 @@ async def _test_setup(
async def _test_setup_failure(hass: HomeAssistantType, config: str) -> None:
"""Test generic Vizio entity setup failure."""
with patch(
"homeassistant.components.vizio.media_player.VizioAsync.can_connect",
"homeassistant.components.vizio.media_player.VizioAsync.can_connect_with_auth_check",
return_value=False,
):
config_entry = MockConfigEntry(domain=DOMAIN, data=config, unique_id=UNIQUE_ID)
@ -133,42 +133,54 @@ async def _test_service(
async def test_speaker_on(
hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture
hass: HomeAssistantType,
vizio_connect: pytest.fixture,
vizio_update: pytest.fixture,
) -> None:
"""Test Vizio Speaker entity setup when on."""
await _test_setup(hass, DEVICE_CLASS_SPEAKER, True)
async def test_speaker_off(
hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture
hass: HomeAssistantType,
vizio_connect: pytest.fixture,
vizio_update: pytest.fixture,
) -> None:
"""Test Vizio Speaker entity setup when off."""
await _test_setup(hass, DEVICE_CLASS_SPEAKER, False)
async def test_speaker_unavailable(
hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture
hass: HomeAssistantType,
vizio_connect: pytest.fixture,
vizio_update: pytest.fixture,
) -> None:
"""Test Vizio Speaker entity setup when unavailable."""
await _test_setup(hass, DEVICE_CLASS_SPEAKER, None)
async def test_init_tv_on(
hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture
hass: HomeAssistantType,
vizio_connect: pytest.fixture,
vizio_update: pytest.fixture,
) -> None:
"""Test Vizio TV entity setup when on."""
await _test_setup(hass, DEVICE_CLASS_TV, True)
async def test_init_tv_off(
hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture
hass: HomeAssistantType,
vizio_connect: pytest.fixture,
vizio_update: pytest.fixture,
) -> None:
"""Test Vizio TV entity setup when off."""
await _test_setup(hass, DEVICE_CLASS_TV, False)
async def test_init_tv_unavailable(
hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture
hass: HomeAssistantType,
vizio_connect: pytest.fixture,
vizio_update: pytest.fixture,
) -> None:
"""Test Vizio TV entity setup when unavailable."""
await _test_setup(hass, DEVICE_CLASS_TV, None)
@ -189,7 +201,9 @@ async def test_setup_failure_tv(
async def test_services(
hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture
hass: HomeAssistantType,
vizio_connect: pytest.fixture,
vizio_update: pytest.fixture,
) -> None:
"""Test all Vizio media player entity services."""
await _test_setup(hass, DEVICE_CLASS_TV, True)
@ -218,7 +232,9 @@ async def test_services(
async def test_options_update(
hass: HomeAssistantType, vizio_connect: pytest.fixture, vizio_update: pytest.fixture
hass: HomeAssistantType,
vizio_connect: pytest.fixture,
vizio_update: pytest.fixture,
) -> None:
"""Test when config entry update event fires."""
await _test_setup(hass, DEVICE_CLASS_SPEAKER, True)