Migrate to voluptuous (#3171)

This commit is contained in:
Fabian Affolter 2016-09-04 04:24:29 +02:00 committed by Teagan Glenn
parent 6f45906eda
commit 8467d07a3d
2 changed files with 45 additions and 63 deletions

View file

@ -36,7 +36,7 @@ class TestSensorMoldIndicator(unittest.TestCase):
'indoor_temp_sensor': 'test.indoortemp',
'outdoor_temp_sensor': 'test.outdoortemp',
'indoor_humidity_sensor': 'test.indoorhumidity',
'calibration_factor': '2.0'
'calibration_factor': 2.0
}
}))
@ -59,13 +59,11 @@ class TestSensorMoldIndicator(unittest.TestCase):
'indoor_temp_sensor': 'test.indoortemp',
'outdoor_temp_sensor': 'test.outdoortemp',
'indoor_humidity_sensor': 'test.indoorhumidity',
'calibration_factor': '2.0'
'calibration_factor': 2.0
}
}))
moldind = self.hass.states.get('sensor.mold_indicator')
assert moldind
# assert state
assert moldind.state == '0'
def test_calculation(self):
@ -76,7 +74,7 @@ class TestSensorMoldIndicator(unittest.TestCase):
'indoor_temp_sensor': 'test.indoortemp',
'outdoor_temp_sensor': 'test.outdoortemp',
'indoor_humidity_sensor': 'test.indoorhumidity',
'calibration_factor': '2.0'
'calibration_factor': 2.0
}
}))
@ -108,23 +106,20 @@ class TestSensorMoldIndicator(unittest.TestCase):
'indoor_temp_sensor': 'test.indoortemp',
'outdoor_temp_sensor': 'test.outdoortemp',
'indoor_humidity_sensor': 'test.indoorhumidity',
'calibration_factor': '2.0'
'calibration_factor': 2.0
}
}))
# Change indoor temp
self.hass.states.set('test.indoortemp', '30',
{ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS})
self.hass.pool.block_till_done()
assert self.hass.states.get('sensor.mold_indicator').state == '90'
# Change outdoor temp
self.hass.states.set('test.outdoortemp', '25',
{ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS})
self.hass.pool.block_till_done()
assert self.hass.states.get('sensor.mold_indicator').state == '57'
# Change humidity
self.hass.states.set('test.indoorhumidity', '20',
{ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS})
self.hass.pool.block_till_done()