update sync data from site dashboard and testing closing cycles
This commit is contained in:
1 parent
36639d8c38
commit
f49e72592c
42 files changed
+1966
-688
No files matched your search
@@ -83,6 +83,26 @@ class OperationsAPITests(TestCase):
|
||||
self.assertEqual(len(results), 1)
|
||||
self.assertEqual(results[0]["date"], date.today().isoformat())
|
||||
|
||||
def test_panel_iot_active_cycle_null_end_date_does_not_500(self):
|
||||
"""Active cycles have end_date=None; filtering must not raise ValueError."""
|
||||
self.cycle.end_date = None
|
||||
self.cycle.status = Cycle.STATUS_ACTIVE
|
||||
self.cycle.save(update_fields=["end_date", "status", "updated_at"])
|
||||
IotPanel.objects.create(
|
||||
flock=self.flock,
|
||||
date=date.today(),
|
||||
average_temperature=27.0,
|
||||
)
|
||||
response = self.client.get(
|
||||
"/api/v1/panel-iot/dates/",
|
||||
{"cycle_id": self.cycle.pk, "flock_id": self.flock.pk},
|
||||
)
|
||||
self.assertEqual(response.status_code, 200, response.data)
|
||||
iso_dates = [
|
||||
d.isoformat() if hasattr(d, "isoformat") else str(d) for d in response.data
|
||||
]
|
||||
self.assertIn(date.today().isoformat(), iso_dates)
|
||||
|
||||
def test_panel_iot_filters_by_flock(self):
|
||||
flock_b = Flock.objects.create(flock_name="Flock B", kandang=self.kandang)
|
||||
row = IotPanel.objects.create(
|
||||
|
||||
Reference in new issue
Block a user