Address Kodi code review follow up (#39104)
* Code review follow up * Update config_flow.py * Update config_flow.py * Update strings.json * Update config_flow.py * Update config_flow.py * Update config_flow.py * Update config_flow.py * Update config_flow.py * Update config_flow.py * Update util.py * Update test_config_flow.py * Update config_flow.py * Update util.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 util.py * Update test_config_flow.py * Update config_flow.py * Update config_flow.py * Update config_flow.py * Update config_flow.py * Update test_config_flow.py * Update test_config_flow.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 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 Co-authored-by: Chris Talkington <chris@talkingtontech.com>
This commit is contained in:
1 parent
3c1c6069da
commit
f075742a86
5 files changed
+536
-188
No files matched your search
@@ -36,6 +36,16 @@ TEST_IMPORT = {
|
||||
}
|
||||
|
||||
|
||||
def get_kodi_connection(
|
||||
host, port, ws_port, username, password, ssl=False, timeout=5, session=None
|
||||
):
|
||||
"""Get Kodi connection."""
|
||||
if ws_port is None:
|
||||
return MockConnection()
|
||||
else:
|
||||
return MockWSConnection()
|
||||
|
||||
|
||||
class MockConnection:
|
||||
"""A mock kodi connection."""
|
||||
|
||||
@@ -65,3 +75,34 @@ class MockConnection:
|
||||
def server(self):
|
||||
"""Mock server."""
|
||||
return None
|
||||
|
||||
|
||||
class MockWSConnection:
|
||||
"""A mock kodi websocket connection."""
|
||||
|
||||
def __init__(self, connected=True):
|
||||
"""Mock the websocket connection."""
|
||||
self._connected = connected
|
||||
|
||||
async def connect(self):
|
||||
"""Mock connect."""
|
||||
pass
|
||||
|
||||
@property
|
||||
def connected(self):
|
||||
"""Mock connected."""
|
||||
return self._connected
|
||||
|
||||
@property
|
||||
def can_subscribe(self):
|
||||
"""Mock can_subscribe."""
|
||||
return False
|
||||
|
||||
async def close(self):
|
||||
"""Mock close."""
|
||||
pass
|
||||
|
||||
@property
|
||||
def server(self):
|
||||
"""Mock server."""
|
||||
return None
|
||||
Reference in new issue
Block a user