State is set to UNKNOWN rather than ON in order to make UI have an play/pause button (#17357)
This commit is contained in:
1 parent
ac79ff9e24
commit
1cbb5b8e51
2 files changed
+13
-14
No files matched your search
@@ -12,8 +12,8 @@ from homeassistant.components.media_player import SUPPORT_TURN_ON, \
|
||||
MEDIA_TYPE_CHANNEL, MEDIA_TYPE_URL
|
||||
from homeassistant.components.media_player.samsungtv import setup_platform, \
|
||||
CONF_TIMEOUT, SamsungTVDevice, SUPPORT_SAMSUNGTV
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, STATE_ON, \
|
||||
CONF_MAC, STATE_OFF
|
||||
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT, CONF_MAC, \
|
||||
STATE_OFF
|
||||
from tests.common import MockDependency
|
||||
from homeassistant.util import dt as dt_util
|
||||
from datetime import timedelta
|
||||
@@ -102,7 +102,7 @@ class TestSamsungTv(unittest.TestCase):
|
||||
def test_update_on(self):
|
||||
"""Testing update tv on."""
|
||||
self.device.update()
|
||||
self.assertEqual(STATE_ON, self.device._state)
|
||||
self.assertEqual(None, self.device._state)
|
||||
|
||||
def test_update_off(self):
|
||||
"""Testing update tv off."""
|
||||
@@ -116,7 +116,7 @@ class TestSamsungTv(unittest.TestCase):
|
||||
def test_send_key(self):
|
||||
"""Test for send key."""
|
||||
self.device.send_key('KEY_POWER')
|
||||
self.assertEqual(STATE_ON, self.device._state)
|
||||
self.assertEqual(None, self.device._state)
|
||||
|
||||
def test_send_key_broken_pipe(self):
|
||||
"""Testing broken pipe Exception."""
|
||||
@@ -126,7 +126,7 @@ class TestSamsungTv(unittest.TestCase):
|
||||
self.device.get_remote = mock.Mock(return_value=_remote)
|
||||
self.device.send_key('HELLO')
|
||||
self.assertIsNone(self.device._remote)
|
||||
self.assertEqual(STATE_ON, self.device._state)
|
||||
self.assertEqual(None, self.device._state)
|
||||
|
||||
def test_send_key_connection_closed_retry_succeed(self):
|
||||
"""Test retry on connection closed."""
|
||||
@@ -137,7 +137,7 @@ class TestSamsungTv(unittest.TestCase):
|
||||
self.device.get_remote = mock.Mock(return_value=_remote)
|
||||
command = 'HELLO'
|
||||
self.device.send_key(command)
|
||||
self.assertEqual(STATE_ON, self.device._state)
|
||||
self.assertEqual(None, self.device._state)
|
||||
# verify that _remote.control() get called twice because of retry logic
|
||||
expected = [mock.call(command),
|
||||
mock.call(command)]
|
||||
@@ -152,7 +152,7 @@ class TestSamsungTv(unittest.TestCase):
|
||||
self.device.get_remote = mock.Mock(return_value=_remote)
|
||||
self.device.send_key('HELLO')
|
||||
self.assertIsNone(self.device._remote)
|
||||
self.assertEqual(STATE_ON, self.device._state)
|
||||
self.assertEqual(None, self.device._state)
|
||||
|
||||
def test_send_key_os_error(self):
|
||||
"""Testing broken pipe Exception."""
|
||||
@@ -177,8 +177,8 @@ class TestSamsungTv(unittest.TestCase):
|
||||
|
||||
def test_state(self):
|
||||
"""Test for state property."""
|
||||
self.device._state = STATE_ON
|
||||
self.assertEqual(STATE_ON, self.device.state)
|
||||
self.device._state = None
|
||||
self.assertEqual(None, self.device.state)
|
||||
self.device._state = STATE_OFF
|
||||
self.assertEqual(STATE_OFF, self.device.state)
|
||||
|
||||
|
||||
Reference in new issue
Block a user