UPDATE
This commit is contained in:
@@ -68,7 +68,7 @@ class WaterStressServiceTests(TestCase):
|
||||
|
||||
@patch("irrigation.indicators.apps.get_app_config")
|
||||
@patch("irrigation.indicators.SensorData.objects.filter")
|
||||
def test_service_falls_back_when_crop_simulation_fails(self, mock_filter, mock_get_app_config):
|
||||
def test_service_raises_when_crop_simulation_fails(self, mock_filter, mock_get_app_config):
|
||||
mock_filter.return_value.first.return_value = SimpleNamespace(
|
||||
farm_uuid="550e8400-e29b-41d4-a716-446655440000",
|
||||
soil_moisture=46.0,
|
||||
@@ -82,9 +82,7 @@ class WaterStressServiceTests(TestCase):
|
||||
get_water_stress_service=lambda: BrokenService()
|
||||
)
|
||||
|
||||
payload = WaterStressService().get_water_stress(
|
||||
farm_uuid="550e8400-e29b-41d4-a716-446655440000"
|
||||
)
|
||||
|
||||
self.assertEqual(payload["sourceMetric"]["engine"], "sensor_fallback")
|
||||
self.assertEqual(payload["sourceMetric"]["fallbackReason"], "simulation offline")
|
||||
with self.assertRaises(RuntimeError):
|
||||
WaterStressService().get_water_stress(
|
||||
farm_uuid="550e8400-e29b-41d4-a716-446655440000"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user