def test_update_with_no_template(self): """Test update when there is no value template.""" self.rest.update = Mock('rest.RestData.update', side_effect=self.update_side_effect('true')) self.binary_sensor = rest.RestBinarySensor(self.hass, self.rest, self.name, self.device_class, None) self.binary_sensor.update() assert STATE_ON == self.binary_sensor.state assert self.binary_sensor.available
def setUp(self): """Set up things to be run when tests are started.""" self.hass = get_test_home_assistant() self.rest = Mock("RestData") self.rest.update = Mock( "RestData.update", side_effect=self.update_side_effect('{ "key": false }') ) self.name = "foo" self.device_class = "light" self.value_template = template.Template("{{ value_json.key }}", self.hass) self.binary_sensor = rest.RestBinarySensor( self.hass, self.rest, self.name, self.device_class, self.value_template )