From 3826772b1c5eebda5fce6cbc3f582d2452bb724c Mon Sep 17 00:00:00 2001 From: John Merlie Date: Sun, 2 Jul 2023 12:22:25 -0400 Subject: [PATCH] updated pumping form for start/end/duration --- core/tests/tests_forms.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/tests/tests_forms.py b/core/tests/tests_forms.py index 9545a8dd..68ca75ef 100644 --- a/core/tests/tests_forms.py +++ b/core/tests/tests_forms.py @@ -463,17 +463,23 @@ class PumpingFormsTestCase(FormsTestCaseBase): @classmethod def setUpClass(cls): super(PumpingFormsTestCase, cls).setUpClass() + start = timezone.localtime() - timezone.timedelta(days=1) + end = start + timezone.timedelta(minutes=3) cls.bp = models.Pumping.objects.create( child=cls.child, amount=50.0, - time=timezone.localtime() - timezone.timedelta(days=1), + start=start, + end=end, ) def test_add(self): + start = timezone.localtime() - timezone.timedelta(days=3) + end = start + timezone.timedelta(minutes=5) params = { "child": self.child.id, "amount": "50.0", - "time": self.localtime_string(), + "start": self.localtime_string(start), + "end": self.localtime_string(end), } page = self.c.post("/pumping/add/", params, follow=True) @@ -484,7 +490,8 @@ class PumpingFormsTestCase(FormsTestCaseBase): params = { "child": self.bp.child.id, "amount": self.bp.amount + 2, - "time": self.localtime_string(), + "start": self.localtime_string(self.bp.start), + "end": self.localtime_string(self.bp.end + timezone.timedelta(minutes=15)), } page = self.c.post("/pumping/{}/".format(self.bp.id), params, follow=True) self.assertEqual(page.status_code, 200)