1- from unittest .mock import Mock , patch
1+ from unittest .mock import Mock
22
33import pytest
44
5+ from shedpi_components .temperature_probe import (
6+ TempProbe ,
7+ )
58from shedpi_hub_dashboard .models import DeviceModuleReading
69from shedpi_hub_dashboard .tests .utils .factories import (
710 DeviceModuleFactory ,
1013 ReadingSubmissionService ,
1114)
1215from standalone_modules .temperature_module .device_protocol import DeviceProtocol
13- from standalone_modules .temperature_module .temperature_probe import (
14- TempProbe ,
15- )
1616
1717
18- @patch ("standalone_modules.temperature_module.temperature_probe.Path" )
19- def test_temp_probe_reading_happy_path (mocked_path ):
18+ def test_temp_probe_reading_happy_path (temp_probe_path ):
2019 # FIXME: Get the actual readout from the modules
2120 probe = TempProbe (submission_service = Mock ())
2221 probe .read_temp_raw = Mock (
@@ -30,8 +29,7 @@ def test_temp_probe_reading_happy_path(mocked_path):
3029 assert temp == 12.345
3130
3231
33- @patch ("standalone_modules.temperature_module.temperature_probe.Path" )
34- def test_temp_probe_reading_invalid_reading (mocked_path ):
32+ def test_temp_probe_reading_invalid_reading (temp_probe_path ):
3533 """
3634 TODO:
3735 - Find what a real invalid reading looks like
@@ -49,8 +47,7 @@ def test_temp_probe_reading_invalid_reading(mocked_path):
4947 probe .read_temp ()
5048
5149
52- @patch ("standalone_modules.temperature_module.temperature_probe.Path" )
53- def test_temp_probe_reading_invalid_reading_missing_expected_params (mocked_path ):
50+ def test_temp_probe_reading_invalid_reading_missing_expected_params (temp_probe_path ):
5451 """
5552 YES is missing from the data feed
5653 """
@@ -74,9 +71,8 @@ def test_temp_probe_reading_invalid_reading_missing_expected_params(mocked_path)
7471 probe .read_temp_raw .call_count == 2
7572
7673
77- @patch ("standalone_modules.temperature_module.temperature_probe.Path" )
7874@pytest .mark .django_db
79- def test_temp_logger (mocked_path , live_server ):
75+ def test_temp_logger (temp_probe_path , live_server ):
8076 # Submission service
8177 submission_service = ReadingSubmissionService ()
8278 submission_service .base_url = live_server .url
0 commit comments