PS4 Merge async_setup_platform into async_setup_entry (#25689)

* Merge async_setup_platform into async_setup_entry

* Pass async_setup_platform

* blank line

* add test setup platform

* white space
pull/25702/head
ktnrg45 2019-08-04 21:01:40 -07:00 committed by Aaron Bach
parent 0a87a4bfda
commit 069c1863eb
2 changed files with 10 additions and 5 deletions

View File

@ -58,11 +58,6 @@ DEFAULT_RETRIES = 2
async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up PS4 from a config entry."""
config = config_entry
await async_setup_platform(hass, config, async_add_entities, discovery_info=None)
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up PS4 Platform."""
creds = config.data[CONF_TOKEN]
device_list = []
for device in config.data["devices"]:
@ -74,6 +69,11 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
async_add_entities(device_list, update_before_add=True)
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Not Implemented."""
pass
class PS4Device(MediaPlayerDevice):
"""Representation of a PS4."""

View File

@ -169,6 +169,11 @@ async def mock_ddp_response(hass, mock_status_data, games=None):
await hass.async_block_till_done()
async def test_async_setup_platform_does_nothing():
"""Test setup platform does nothing (Uses config entries only)."""
await ps4.media_player.async_setup_platform(None, None, None)
async def test_media_player_is_setup_correctly_with_entry(hass):
"""Test entity is setup correctly with entry correctly."""
mock_entity_id = await setup_mock_component(hass)