def test_get_temp_to_send(self): """Check if the temperature choice is the last from list with 3 temperatures""" obj_temperature = Temp() list_temp = [15.52, 20.01, 25.06] data = obj_temperature.get_temp_to_send(list_temp) assert data == 25.06
def test_get_temp_to_send_with_none(self): """Check if the temperature choice is correct from list with 1 temperature between None value""" obj_temperature = Temp() list_temp = [None, 20.01, None] data = obj_temperature.get_temp_to_send(list_temp) assert data == 20.01
import pickle from temperature import Temperature from api_request import Api with open('/home/pi/Rasp_Pi-Temp/picklefile', 'rb') as file: data = pickle.load(file) obj_temperature = Temperature() the_temperature = obj_temperature.get_temp_to_send(data) print("the temperature who will be send to database is : " + str(the_temperature)) obj_api = Api() obj_api.request_post_api_with_auth(the_temperature) print("the request has been sent")