def test_dyson_dust_sensor_with_values(self): """Test dust sensor with values.""" sensor = dyson.DysonDustSensor(self.hass, _get_with_state()) sensor.entity_id = "sensor.dyson_1" self.assertFalse(sensor.should_poll) self.assertEqual(sensor.state, 5) self.assertEqual(sensor.unit_of_measurement, 'level') self.assertEqual(sensor.name, "Device_name dust") self.assertEqual(sensor.entity_id, "sensor.dyson_1")
def test_dyson_dust_sensor(self): """Test dust sensor with no value.""" sensor = dyson.DysonDustSensor(_get_device_without_state()) sensor.hass = self.hass sensor.entity_id = "sensor.dyson_1" self.assertFalse(sensor.should_poll) self.assertIsNone(sensor.state) self.assertEqual(sensor.unit_of_measurement, None) self.assertEqual(sensor.name, "Device_name Dust") self.assertEqual(sensor.entity_id, "sensor.dyson_1")
def test_dyson_dust_sensor_with_values(self): """Test dust sensor with values.""" sensor = dyson.DysonDustSensor(_get_with_state()) sensor.hass = self.hass sensor.entity_id = "sensor.dyson_1" assert not sensor.should_poll assert sensor.state == 5 assert sensor.unit_of_measurement is None assert sensor.name == "Device_name Dust" assert sensor.entity_id == "sensor.dyson_1"