updated pumping form for start/end/duration

This commit is contained in:
John Merlie 2023-07-02 12:22:25 -04:00 committed by Christopher Charbonneau Wells
parent 77622c4924
commit 3826772b1c
1 changed files with 10 additions and 3 deletions

View File

@ -463,17 +463,23 @@ class PumpingFormsTestCase(FormsTestCaseBase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
super(PumpingFormsTestCase, cls).setUpClass() super(PumpingFormsTestCase, cls).setUpClass()
start = timezone.localtime() - timezone.timedelta(days=1)
end = start + timezone.timedelta(minutes=3)
cls.bp = models.Pumping.objects.create( cls.bp = models.Pumping.objects.create(
child=cls.child, child=cls.child,
amount=50.0, amount=50.0,
time=timezone.localtime() - timezone.timedelta(days=1), start=start,
end=end,
) )
def test_add(self): def test_add(self):
start = timezone.localtime() - timezone.timedelta(days=3)
end = start + timezone.timedelta(minutes=5)
params = { params = {
"child": self.child.id, "child": self.child.id,
"amount": "50.0", "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) page = self.c.post("/pumping/add/", params, follow=True)
@ -484,7 +490,8 @@ class PumpingFormsTestCase(FormsTestCaseBase):
params = { params = {
"child": self.bp.child.id, "child": self.bp.child.id,
"amount": self.bp.amount + 2, "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) page = self.c.post("/pumping/{}/".format(self.bp.id), params, follow=True)
self.assertEqual(page.status_code, 200) self.assertEqual(page.status_code, 200)