From 88fb30af110d227b351163678c92198ae3031b64 Mon Sep 17 00:00:00 2001 From: Doug Hoffman Date: Wed, 14 Jul 2021 04:45:47 -0400 Subject: [PATCH] Bump pyatv to 0.8.1 (#52849) * Bump pyatv to 0.8.1 * Update apple_tv tests for new create_session location * Update test_user_adds_unusable_device to try device with no services pyatv >=0.8.0 considers AirPlay a valid service and no longer fails under the previous conditions. --- homeassistant/components/apple_tv/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- tests/components/apple_tv/conftest.py | 13 +++++-------- tests/components/apple_tv/test_config_flow.py | 6 +++--- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/homeassistant/components/apple_tv/manifest.json b/homeassistant/components/apple_tv/manifest.json index 963cbb9be33..d4eb322f4d7 100644 --- a/homeassistant/components/apple_tv/manifest.json +++ b/homeassistant/components/apple_tv/manifest.json @@ -3,7 +3,7 @@ "name": "Apple TV", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/apple_tv", - "requirements": ["pyatv==0.7.7"], + "requirements": ["pyatv==0.8.1"], "zeroconf": ["_mediaremotetv._tcp.local.", "_touch-able._tcp.local."], "after_dependencies": ["discovery"], "codeowners": ["@postlund"], diff --git a/requirements_all.txt b/requirements_all.txt index db305130f24..da020c665f2 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1316,7 +1316,7 @@ pyatmo==5.2.0 pyatome==0.1.1 # homeassistant.components.apple_tv -pyatv==0.7.7 +pyatv==0.8.1 # homeassistant.components.bbox pybbox==0.0.5-alpha diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 9f4e2ab5855..87a084a3ece 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -741,7 +741,7 @@ pyatag==0.3.5.3 pyatmo==5.2.0 # homeassistant.components.apple_tv -pyatv==0.7.7 +pyatv==0.8.1 # homeassistant.components.blackbird pyblackbird==0.5 diff --git a/tests/components/apple_tv/conftest.py b/tests/components/apple_tv/conftest.py index db543007fb2..f07fa7d70bb 100644 --- a/tests/components/apple_tv/conftest.py +++ b/tests/components/apple_tv/conftest.py @@ -2,7 +2,8 @@ from unittest.mock import patch -from pyatv import conf, net +from pyatv import conf +from pyatv.support.http import create_session import pytest from .common import MockPairingHandler, create_conf @@ -39,7 +40,7 @@ def pairing(): async def _pair(config, protocol, loop, session=None, **kwargs): handler = MockPairingHandler( - await net.create_session(session), config.get_service(protocol) + await create_session(session), config.get_service(protocol) ) handler.always_fail = mock_pair.always_fail return handler @@ -121,11 +122,7 @@ def dmap_device_with_credentials(mock_scan): @pytest.fixture -def airplay_device(mock_scan): +def device_with_no_services(mock_scan): """Mock pyatv.scan.""" - mock_scan.result.append( - create_conf( - "127.0.0.1", "AirPlay Device", conf.AirPlayService("airplayid", port=7777) - ) - ) + mock_scan.result.append(create_conf("127.0.0.1", "Invalid Device")) yield mock_scan diff --git a/tests/components/apple_tv/test_config_flow.py b/tests/components/apple_tv/test_config_flow.py index 615a1f404f5..45edaa36251 100644 --- a/tests/components/apple_tv/test_config_flow.py +++ b/tests/components/apple_tv/test_config_flow.py @@ -236,15 +236,15 @@ async def test_user_adds_existing_device(hass, mrp_device): assert result2["errors"] == {"base": "already_configured"} -async def test_user_adds_unusable_device(hass, airplay_device): - """Test that it is not possible to add pure AirPlay device.""" +async def test_user_adds_unusable_device(hass, device_with_no_services): + """Test that it is not possible to add device with no services.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER} ) result2 = await hass.config_entries.flow.async_configure( result["flow_id"], - {"device_input": "AirPlay Device"}, + {"device_input": "Invalid Device"}, ) assert result2["type"] == data_entry_flow.RESULT_TYPE_FORM assert result2["errors"] == {"base": "no_usable_service"}