This commit is contained in:
2026-05-09 16:55:06 +03:30
parent 1679825ae2
commit cead7dafe2
51 changed files with 7514 additions and 1221 deletions
@@ -88,36 +88,7 @@ class ReportingAndAiJourneyTests(IntegrationAPITestCase):
)
self.assertEqual(soil_response.status_code, 200)
self.assertEqual(soil_response.json()["data"]["source"], "database")
self.assertEqual(len(soil_response.json()["data"]["depths"]), 3)
queued_location = {}
def soil_delay_stub(lat: float, lon: float):
location = self.create_complete_location(lat=lat, lon=lon)
queued_location["id"] = location.id
return SimpleNamespace(id="soil-task-1")
with patch("location_data.views.fetch_soil_data_task.delay", side_effect=soil_delay_stub):
queued_response = self.client.post(
"/api/soil-data/",
data={"lat": "36.100000", "lon": "52.200000"},
format="json",
)
self.assertEqual(queued_response.status_code, 202)
with patch(
"celery.result.AsyncResult",
return_value=FakeAsyncResult(
state="SUCCESS",
result={"status": "completed", "location_id": queued_location["id"]},
),
):
soil_status_response = self.client.get("/api/soil-data/tasks/soil-task-1/status/")
self.assertEqual(soil_status_response.status_code, 200)
self.assertEqual(
soil_status_response.json()["data"]["result"]["id"],
queued_location["id"],
)
self.assertIn("satellite_snapshots", soil_response.json()["data"])
weather_response = self.client.post(
"/api/weather/farm-card/",