Exemplo n.º 1
0
    def test_foia_followup(self):
        """Make sure the follow up date is set correctly"""
        # pylint: disable=protected-access
        foia = FOIARequestFactory(
            composer__datetime_submitted=timezone.now(),
            status="processed",
            agency__jurisdiction__level="s",
            agency__jurisdiction__law__days=10,
        )
        FOIACommunicationFactory(foia=foia, response=True)
        foia.followup()
        self.run_commit_hooks()
        nose.tools.assert_in("I can expect", mail.outbox[-1].body)
        nose.tools.eq_(
            foia.date_followup,
            foia.communications.last().datetime.date() +
            timedelta(foia._followup_days()),
        )

        nose.tools.eq_(foia._followup_days(), 15)

        num_days = 365
        foia.date_estimate = date.today() + timedelta(num_days)
        foia.followup()
        self.run_commit_hooks()
        nose.tools.assert_in("I am still", mail.outbox[-1].body)
        nose.tools.eq_(foia._followup_days(), num_days)

        foia.date_estimate = date.today()
        foia.followup()
        self.run_commit_hooks()
        nose.tools.assert_in("check on the status", mail.outbox[-1].body)
        nose.tools.eq_(foia._followup_days(), 15)
Exemplo n.º 2
0
    def test_foia_followup(self):
        """Make sure the follow up date is set correctly"""
        # pylint: disable=protected-access
        foia = FOIARequestFactory(
            composer__datetime_submitted=timezone.now(),
            status='processed',
            agency__jurisdiction__level='s',
            agency__jurisdiction__law__days=10,
        )
        FOIACommunicationFactory(
            foia=foia,
            response=True,
        )
        foia.followup()
        nose.tools.assert_in('I can expect', mail.outbox[-1].body)
        nose.tools.eq_(
            foia.date_followup,
            date.today() + timedelta(foia._followup_days())
        )

        nose.tools.eq_(foia._followup_days(), 15)

        num_days = 365
        foia.date_estimate = date.today() + timedelta(num_days)
        foia.followup()
        nose.tools.assert_in('I am still', mail.outbox[-1].body)
        nose.tools.eq_(foia._followup_days(), num_days)

        foia.date_estimate = date.today()
        foia.followup()
        nose.tools.assert_in('check on the status', mail.outbox[-1].body)
        nose.tools.eq_(foia._followup_days(), 15)