UPDATE
This commit is contained in:
@@ -239,14 +239,13 @@ class ReportingAndAiJourneyTests(IntegrationAPITestCase):
|
||||
patch(
|
||||
"rag.services.irrigation.get_irrigation_recommendation",
|
||||
return_value={
|
||||
"plan": {
|
||||
"frequencyPerWeek": 3,
|
||||
"durationMinutes": 28,
|
||||
"bestTimeOfDay": "05:30",
|
||||
"moistureLevel": 68,
|
||||
"warning": "",
|
||||
},
|
||||
"raw_response": "{\"plan\": {\"frequencyPerWeek\": 3}}",
|
||||
"sections": [
|
||||
{
|
||||
"type": "recommendation",
|
||||
"title": "برنامه آبیاری بهینه",
|
||||
"content": "هفته ای 3 نوبت آبیاری انجام شود.",
|
||||
}
|
||||
],
|
||||
},
|
||||
)
|
||||
)
|
||||
@@ -254,11 +253,14 @@ class ReportingAndAiJourneyTests(IntegrationAPITestCase):
|
||||
patch(
|
||||
"rag.services.fertilization.get_fertilization_recommendation",
|
||||
return_value={
|
||||
"plan": {
|
||||
"npkRatio": "15-5-30",
|
||||
"amountPerHectare": "60 kg",
|
||||
},
|
||||
"raw_response": "{\"plan\": {\"npkRatio\": \"15-5-30\"}}",
|
||||
"sections": [
|
||||
{
|
||||
"type": "recommendation",
|
||||
"title": "برنامه کودهی بهینه",
|
||||
"fertilizerType": "15-5-30",
|
||||
"amount": "60 kg",
|
||||
}
|
||||
],
|
||||
},
|
||||
)
|
||||
)
|
||||
@@ -304,37 +306,6 @@ class ReportingAndAiJourneyTests(IntegrationAPITestCase):
|
||||
streamed_text = b"".join(chat_response.streaming_content).decode("utf-8")
|
||||
self.assertIn("Moisture is acceptable", streamed_text)
|
||||
|
||||
rag_irrigation_response = self.client.post(
|
||||
"/api/rag/recommend/irrigation/",
|
||||
data={
|
||||
"farm_uuid": str(self.farm_uuid),
|
||||
"plant_name": "Tomato",
|
||||
"growth_stage": "flowering",
|
||||
"irrigation_method_name": "Analytics Drip",
|
||||
},
|
||||
format="json",
|
||||
)
|
||||
self.assertEqual(rag_irrigation_response.status_code, 200)
|
||||
self.assertEqual(
|
||||
rag_irrigation_response.json()["data"]["plan"]["frequencyPerWeek"],
|
||||
3,
|
||||
)
|
||||
|
||||
rag_fertilization_response = self.client.post(
|
||||
"/api/rag/recommend/fertilization/",
|
||||
data={
|
||||
"farm_uuid": str(self.farm_uuid),
|
||||
"plant_name": "Tomato",
|
||||
"growth_stage": "flowering",
|
||||
},
|
||||
format="json",
|
||||
)
|
||||
self.assertEqual(rag_fertilization_response.status_code, 200)
|
||||
self.assertEqual(
|
||||
rag_fertilization_response.json()["data"]["plan"]["npkRatio"],
|
||||
"15-5-30",
|
||||
)
|
||||
|
||||
irrigation_recommend_response = self.client.post(
|
||||
"/api/irrigation/recommend/",
|
||||
data={
|
||||
@@ -346,6 +317,10 @@ class ReportingAndAiJourneyTests(IntegrationAPITestCase):
|
||||
format="json",
|
||||
)
|
||||
self.assertEqual(irrigation_recommend_response.status_code, 200)
|
||||
self.assertEqual(
|
||||
irrigation_recommend_response.json()["data"]["sections"][0]["type"],
|
||||
"recommendation",
|
||||
)
|
||||
|
||||
fertilization_recommend_response = self.client.post(
|
||||
"/api/fertilization/recommend/",
|
||||
@@ -357,6 +332,10 @@ class ReportingAndAiJourneyTests(IntegrationAPITestCase):
|
||||
format="json",
|
||||
)
|
||||
self.assertEqual(fertilization_recommend_response.status_code, 200)
|
||||
self.assertEqual(
|
||||
fertilization_recommend_response.json()["data"]["sections"][0]["fertilizerType"],
|
||||
"15-5-30",
|
||||
)
|
||||
|
||||
pest_detect_response = self.client.post(
|
||||
"/api/pest-disease/detect/",
|
||||
|
||||
Reference in New Issue
Block a user