Do not call update() in constructor (#8892)
This commit is contained in:
parent
f513f6271e
commit
be94f6e939
5 changed files with 25 additions and 23 deletions
|
@ -29,7 +29,7 @@ class TestCommandSensorBinarySensor(unittest.TestCase):
|
|||
|
||||
devices = []
|
||||
|
||||
def add_dev_callback(devs):
|
||||
def add_dev_callback(devs, update):
|
||||
"""Add callback to add devices."""
|
||||
for dev in devs:
|
||||
devices.append(dev)
|
||||
|
@ -38,6 +38,7 @@ class TestCommandSensorBinarySensor(unittest.TestCase):
|
|||
|
||||
self.assertEqual(1, len(devices))
|
||||
entity = devices[0]
|
||||
entity.update()
|
||||
self.assertEqual('Test', entity.name)
|
||||
self.assertEqual(STATE_ON, entity.state)
|
||||
|
||||
|
@ -58,7 +59,7 @@ class TestCommandSensorBinarySensor(unittest.TestCase):
|
|||
entity = command_line.CommandBinarySensor(
|
||||
self.hass, data, 'test', None, '1.0', '0',
|
||||
template.Template('{{ value | multiply(0.1) }}', self.hass))
|
||||
|
||||
entity.update()
|
||||
self.assertEqual(STATE_ON, entity.state)
|
||||
|
||||
def test_sensor_off(self):
|
||||
|
@ -67,5 +68,5 @@ class TestCommandSensorBinarySensor(unittest.TestCase):
|
|||
|
||||
entity = command_line.CommandBinarySensor(
|
||||
self.hass, data, 'test', None, '1', '0', None)
|
||||
|
||||
entity.update()
|
||||
self.assertEqual(STATE_OFF, entity.state)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue