Optimize directv client initialization (#32706)

* Optimize directv client initialization.

* Update config_flow.py

* Update media_player.py

* Update media_player.py

* Update __init__.py

* Update __init__.py

* Update __init__.py

* Update __init__.py

* Update test_media_player.py

* Update __init__.py

* Update media_player.py

* Update test_media_player.py

* Update media_player.py

* Update test_media_player.py

* Update config_flow.py

* Update test_config_flow.py

* Update test_config_flow.py

* Update test_config_flow.py

* Update test_config_flow.py

* Update test_config_flow.py

* Update test_config_flow.py

* Update __init__.py

* Update test_config_flow.py

* Update test_config_flow.py

* Update test_media_player.py

* Update test_media_player.py

* Update __init__.py

* Update __init__.py

* Update __init__.py
This commit is contained in:
Chris Talkington authored and Paulus Schoutsen committed 2020-03-15 11:52:45 -07:00
1 parent 86c4fa0fc5
commit 1b622925a1
6 files changed
+50 -108

No files matched your search

+15 -8
View File
@@ -1,4 +1,6 @@
"""Tests for the DirecTV component."""
from DirectPy import DIRECTV
from homeassistant.components.directv.const import DOMAIN
from homeassistant.const import CONF_HOST
from homeassistant.helpers.typing import HomeAssistantType
@@ -94,18 +96,23 @@ MOCK_GET_VERSION = {
}
class MockDirectvClass:
class MockDirectvClass(DIRECTV):
"""A fake DirecTV DVR device."""
def __init__(self, ip, port=8080, clientAddr="0"):
def __init__(self, ip, port=8080, clientAddr="0", determine_state=False):
"""Initialize the fake DirecTV device."""
self._host = ip
self._port = port
self._device = clientAddr
self._standby = True
self._play = False
super().__init__(
ip=ip, port=port, clientAddr=clientAddr, determine_state=determine_state,
)
self.attributes = LIVE
self._play = False
self._standby = True
if self.clientAddr == CLIENT_ADDRESS:
self.attributes = RECORDING
self._standby = False
else:
self.attributes = LIVE
def get_locations(self):
"""Mock for get_locations method."""