Exemplo n.º 1
0
def test_temp_log():
    sensor = FakeTempSensor()
    services.TempMonitor = TempMonitor(sensor)
    from src.services.database import temps
    temps.remove()
    from src.services.database.temp_log import TempLog
    sensor.temp = 12
    services.TempMonitor.check_temp()

    assert TempLog.get_all()[0].temp == 12

    sensor.temp = 3
    services.TempMonitor.check_temp()

    assert TempLog.get_all()[0].temp == 12
    assert TempLog.get_all()[1].temp == 3
    print("temp log passed")
Exemplo n.º 2
0
def get_temps():
    return Response(json.dumps({"data": TempLog.get_all_dic()}, default=json_util.default), mimetype='application/json')