def test_days_overdue(self): """Days overdue should just be the inverse of days_until_due.""" overdue_date = timezone.now().date() - timedelta( self.foi.jurisdiction.get_days() + 10) factories.FoiaMachineCommunicationFactory(request=self.foi, date=overdue_date) eq_(self.foi.days_overdue, self.foi.days_until_due * -1)
def test_days_until_due(self): """The days until due should compare the date due to today's date.""" comm = factories.FoiaMachineCommunicationFactory(request=self.foi) eq_(self.foi.days_until_due, (self.foi.date_due - timezone.now()).days) # If there is no communication, the default should be 0 comm.delete() eq_(self.foi.days_until_due, 0)
def setUp(self): self.comm = factories.FoiaMachineCommunicationFactory() self.view = views.FoiaMachineCommunicationDeleteView.as_view() self.kwargs = { 'foi_slug': self.comm.request.slug, 'foi_pk': self.comm.request.pk, 'pk': self.comm.pk, } self.url = reverse('comm-delete', host='foiamachine', kwargs=self.kwargs)
def test_is_overdue(self): """The request should be overdue if days_until_due is negative.""" overdue_date = timezone.now().date() - timedelta( self.foi.jurisdiction.get_days() + 10) comm = factories.FoiaMachineCommunicationFactory(request=self.foi, date=overdue_date) ok_(self.foi.is_overdue) # Now let's make it not overdue comm.date = timezone.now().date() comm.save() ok_(not self.foi.is_overdue)
def setUp(self): self.comm = factories.FoiaMachineCommunicationFactory() self.view = views.FoiaMachineCommunicationDeleteView.as_view() self.kwargs = { "foi_slug": self.comm.request.slug, "foi_pk": self.comm.request.pk, "pk": self.comm.pk, } self.url = reverse("comm-delete", host="foiamachine", kwargs=self.kwargs)
def test_date_due(self): """The date due should be the date submitted plus the jurisdiction's response time.""" comm = factories.FoiaMachineCommunicationFactory(request=self.foi) expected_date_due = comm.date.date() + timedelta( self.foi.jurisdiction.get_days()) eq_(self.foi.date_due, expected_date_due)
def test_date_submitted(self): """The date submitted should be the first communication date or None.""" comm = factories.FoiaMachineCommunicationFactory(request=self.foi) eq_(self.foi.date_submitted, comm.date.date())
def setUp(self): self.comm = factories.FoiaMachineCommunicationFactory() self.file = factories.FoiaMachineFileFactory(communication=self.comm)
def setUp(self): self.foi = factories.FoiaMachineRequestFactory() self.comm = factories.FoiaMachineCommunicationFactory(request=self.foi)