def test_setup(self): """Test sensor setup.""" config = {'name': 'Test', 'unit_of_measurement': 'in', 'command': 'echo 5', 'command_timeout': 15 } devices = [] def add_dev_callback(devs, update): """Add callback to add devices.""" for dev in devs: devices.append(dev) command_line.setup_platform(self.hass, config, add_dev_callback) assert 1 == len(devices) entity = devices[0] entity.update() assert 'Test' == entity.name assert 'in' == entity.unit_of_measurement assert '5' == entity.state
def test_setup(self): """Test sensor setup.""" config = { "name": "Test", "unit_of_measurement": "in", "command": "echo 5", "command_timeout": 15, } devices = [] def add_dev_callback(devs, update): """Add callback to add devices.""" for dev in devs: devices.append(dev) command_line.setup_platform(self.hass, config, add_dev_callback) assert len(devices) == 1 entity = devices[0] entity.update() assert entity.name == "Test" assert entity.unit_of_measurement == "in" assert entity.state == "5"