add a function to collect the pressure

This commit is contained in:
Andreas Zweili 2019-10-20 13:37:01 +02:00
parent 16050cc176
commit ae2b7c1624
2 changed files with 10 additions and 1 deletions

View File

@ -14,7 +14,8 @@ def get_temperature():
def get_pressure():
return sense.get_pressure()
raw_pressure = sense.get_pressure()
return round(raw_pressure, 1)
def get_humidity():

View File

@ -14,3 +14,11 @@ def test_temp_collector(monkeypatch):
monkeypatch.setattr(collector.sense, 'get_temperature', mock_temp)
assert collector.get_temperature() == 25.3
def test_pressure_collector(monkeypatch):
def mock_pressure():
return 1013.345
monkeypatch.setattr(collector.sense, 'get_pressure', mock_pressure)
assert collector.get_pressure() == 1013.3