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
+1 -21
View File
@@ -7,7 +7,7 @@ import uuid
from django.test import TransactionTestCase
from rest_framework.test import APIClient
from location_data.models import NdviObservation, SoilDepthData, SoilLocation
from location_data.models import NdviObservation, SoilLocation
from weather.models import WeatherForecast
@@ -55,32 +55,12 @@ class IntegrationAPITestCase(TransactionTestCase):
lat: float,
lon: float,
boundary: dict[str, Any] | None = None,
clay_values: tuple[float, float, float] = (22.0, 18.0, 15.0),
nitrogen_values: tuple[float, float, float] = (14.0, 11.0, 8.0),
) -> SoilLocation:
location = SoilLocation.objects.create(
latitude=f"{lat:.6f}",
longitude=f"{lon:.6f}",
farm_boundary=boundary or square_boundary(lat, lon),
)
depth_labels = (
SoilDepthData.DEPTH_0_5,
SoilDepthData.DEPTH_5_15,
SoilDepthData.DEPTH_15_30,
)
for index, depth_label in enumerate(depth_labels):
SoilDepthData.objects.create(
soil_location=location,
depth_label=depth_label,
clay=clay_values[index],
nitrogen=nitrogen_values[index],
sand=40.0 - (index * 2),
silt=25.0 + index,
phh2o=6.6 + (index * 0.1),
wv0010=0.41 - (index * 0.02),
wv0033=0.28 - (index * 0.01),
wv1500=0.12 - (index * 0.01),
)
return location
def seed_weather_forecasts(