UPDATE
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
from unittest.mock import patch
|
||||
|
||||
from django.test import TestCase
|
||||
from django.test import TestCase, override_settings
|
||||
from rest_framework.test import APIClient
|
||||
|
||||
|
||||
@override_settings(ROOT_URLCONF="config.test_urls")
|
||||
class RagRecommendationApiTests(TestCase):
|
||||
def setUp(self):
|
||||
self.client = APIClient()
|
||||
@@ -21,7 +22,7 @@ class RagRecommendationApiTests(TestCase):
|
||||
response = self.client.post(
|
||||
"/api/rag/recommend/irrigation/",
|
||||
data={
|
||||
"sensor_uuid": "sensor-123",
|
||||
"farm_uuid": "sensor-123",
|
||||
"plant_name": "گوجهفرنگی",
|
||||
"growth_stage": "میوهدهی",
|
||||
"irrigation_method_name": "قطرهای",
|
||||
@@ -32,7 +33,7 @@ class RagRecommendationApiTests(TestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.json()["data"]["plan"]["frequencyPerWeek"], 3)
|
||||
mock_get_irrigation_recommendation.assert_called_once_with(
|
||||
sensor_uuid="sensor-123",
|
||||
farm_uuid="sensor-123",
|
||||
plant_name="گوجهفرنگی",
|
||||
growth_stage="میوهدهی",
|
||||
irrigation_method_name="قطرهای",
|
||||
@@ -52,7 +53,7 @@ class RagRecommendationApiTests(TestCase):
|
||||
response = self.client.post(
|
||||
"/api/rag/recommend/fertilization/",
|
||||
data={
|
||||
"sensor_uuid": "sensor-456",
|
||||
"farm_uuid": "sensor-456",
|
||||
"plant_name": "گندم",
|
||||
"growth_stage": "رویشی",
|
||||
},
|
||||
@@ -62,7 +63,7 @@ class RagRecommendationApiTests(TestCase):
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.json()["data"]["plan"]["npkRatio"], "20-20-20")
|
||||
mock_get_fertilization_recommendation.assert_called_once_with(
|
||||
sensor_uuid="sensor-456",
|
||||
farm_uuid="sensor-456",
|
||||
plant_name="گندم",
|
||||
growth_stage="رویشی",
|
||||
query=None,
|
||||
|
||||
Reference in New Issue
Block a user