def test_temperature_status_set_not_available(): THERMAL_NAME = 'Chassis 1 Thermal 1' temperature_status = thermalctld.TemperatureStatus() temperature_status.temperature = 20.0 temperature_status.set_temperature(THERMAL_NAME, thermalctld.NOT_AVAILABLE) assert temperature_status.temperature is None assert temperature_status.log_warning.call_count == 1 temperature_status.log_warning.assert_called_with('Temperature of {} became unavailable'.format(THERMAL_NAME))
def test_temperstatus_set_under_temper(): temperature_status = thermalctld.TemperatureStatus() ret = temperature_status.set_under_temperature(thermalctld.NOT_AVAILABLE, thermalctld.NOT_AVAILABLE) assert not ret ret = temperature_status.set_under_temperature(thermalctld.NOT_AVAILABLE, 0) assert not ret ret = temperature_status.set_under_temperature(0, thermalctld.NOT_AVAILABLE) assert not ret ret = temperature_status.set_under_temperature(1, 2) assert ret assert temperature_status.under_temperature ret = temperature_status.set_under_temperature(2, 1) assert ret assert not temperature_status.under_temperature