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.
This commit is contained in:
Doug Hoffman 2021-07-14 04:45:47 -04:00 committed by GitHub
parent f13a15f2a6
commit 88fb30af11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 14 deletions

View File

@ -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"],

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"}