mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Fix attribute entity (#8066)
* Bugfix entity attribute setter * Fix tests * Fix tests part 2 * Change filter only None * Fix tests part 3 * Update entity.py * Fix tests
This commit is contained in:
committed by
Paulus Schoutsen
parent
32a84f1466
commit
2438c6b7c2
@@ -35,7 +35,7 @@ class TestSensorMQTT(unittest.TestCase):
|
||||
|
||||
state = self.hass.states.get('switch.test')
|
||||
self.assertEqual(STATE_OFF, state.state)
|
||||
self.assertIsNone(state.attributes.get(ATTR_ASSUMED_STATE))
|
||||
self.assertFalse(state.attributes.get(ATTR_ASSUMED_STATE))
|
||||
|
||||
fire_mqtt_message(self.hass, 'state-topic', '1')
|
||||
self.hass.block_till_done()
|
||||
|
||||
@@ -59,7 +59,7 @@ def test_default_setup(hass, monkeypatch):
|
||||
switch_after_first_command = hass.states.get('switch.test')
|
||||
assert switch_after_first_command.state == 'on'
|
||||
# also after receiving first command state not longer has to be assumed
|
||||
assert 'assumed_state' not in switch_after_first_command.attributes
|
||||
assert not switch_after_first_command.attributes.get('assumed_state')
|
||||
|
||||
# mock incoming command event for this device
|
||||
event_callback({
|
||||
|
||||
@@ -161,7 +161,7 @@ class TestTemplateSwitch:
|
||||
self.hass.block_till_done()
|
||||
|
||||
state = self.hass.states.get('switch.test_template_switch')
|
||||
assert 'icon' not in state.attributes
|
||||
assert state.attributes.get('icon') == ''
|
||||
|
||||
state = self.hass.states.set('switch.test_state', STATE_ON)
|
||||
self.hass.block_till_done()
|
||||
|
||||
Reference in New Issue
Block a user