Avoid Ps4 doing I/O during tests (#44845)
parent
34161f3ff6
commit
009663602a
|
@ -18,6 +18,13 @@ def patch_save_json():
|
|||
yield mock_save
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def patch_get_status():
|
||||
"""Prevent save JSON being used."""
|
||||
with patch("pyps4_2ndscreen.ps4.get_status", return_value=None) as mock_get_status:
|
||||
yield mock_get_status
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def patch_io(patch_load_json, patch_save_json):
|
||||
def patch_io(patch_load_json, patch_save_json, patch_get_status):
|
||||
"""Prevent PS4 doing I/O."""
|
||||
|
|
|
@ -288,10 +288,10 @@ async def test_media_attributes_are_loaded(hass, patch_load_json):
|
|||
assert mock_attrs.get(ATTR_MEDIA_CONTENT_TYPE) == MOCK_TITLE_TYPE
|
||||
|
||||
|
||||
async def test_device_info_is_set_from_status_correctly(hass):
|
||||
async def test_device_info_is_set_from_status_correctly(hass, patch_get_status):
|
||||
"""Test that device info is set correctly from status update."""
|
||||
mock_d_registry = mock_device_registry(hass)
|
||||
with patch("pyps4_2ndscreen.ps4.get_status", return_value=MOCK_STATUS_STANDBY):
|
||||
patch_get_status.return_value = MOCK_STATUS_STANDBY
|
||||
mock_entity_id = await setup_mock_component(hass)
|
||||
|
||||
await hass.async_block_till_done()
|
||||
|
@ -305,7 +305,7 @@ async def test_device_info_is_set_from_status_correctly(hass):
|
|||
|
||||
mock_d_entries = mock_d_registry.devices
|
||||
mock_entry = mock_d_registry.async_get_device(
|
||||
identifiers={(DOMAIN, MOCK_HOST_ID)}, connections={()}
|
||||
identifiers={(DOMAIN, MOCK_HOST_ID)}, connections=set()
|
||||
)
|
||||
assert mock_state == STATE_STANDBY
|
||||
|
||||
|
|
Loading…
Reference in New Issue