def test_battery_sensor(self):
    'Test battery sensor.'
    device = mock_device(10, 'Family Room', 'Canary Flex')
    location = mock_location('Home')
    data = Mock()
    data.get_reading.return_value = 70.4567
    sensor = CanarySensor(data, SENSOR_TYPES[4], location, device)
    sensor.update()
    assert ('Home Family Room Battery' == sensor.name)
    assert ('%' == sensor.unit_of_measurement)
    assert (70.46 == sensor.state)
    assert ('mdi:battery-70' == sensor.icon)
Test battery sensor.
def test_battery_sensor(self):
    
    device = mock_device(10, 'Family Room', 'Canary Flex')
    location = mock_location('Home')
    data = Mock()
    data.get_reading.return_value = 70.4567
    sensor = CanarySensor(data, SENSOR_TYPES[4], location, device)
    sensor.update()
    assert ('Home Family Room Battery' == sensor.name)
    assert ('%' == sensor.unit_of_measurement)
    assert (70.46 == sensor.state)
    assert ('mdi:battery-70' == sensor.icon)