def test_attachment_invalid(self):
        """If Total actual amount > 100,000 need attachment with
        type Final Partnership Review
        """
        frs = FundsReservationHeaderFactory(
            intervention=self.intervention,
            total_amt=0.00,
            total_amt_local=120000.00,
            actual_amt_local=120000.00,
            actual_amt=120000.00,
            outstanding_amt_local=0.00,
            outstanding_amt=0.00,
            intervention_amt=0.00,
        )

        with self.assertRaisesRegexp(
                TransitionError,
                'Total amount transferred greater than 100,000 and no '
                'Final Partnership Review was attached'
        ):
            transition_to_closed(self.intervention)
        self.expected["total_actual_amt"] = 120000.00
        self.expected["total_actual_amt_usd"] = 120000.00
        self.expected["total_frs_amt"] = 120000.00
        self.expected["earliest_start_date"] = frs.start_date
        self.expected["latest_end_date"] = frs.end_date
        self.assertFundamentals(self.intervention.total_frs)
    def test_attachment_invalid(self):
        """If Total actual amount > 100,000 need attachment with
        type Final Partnership Review
        """
        frs = FundsReservationHeaderFactory(
            intervention=self.intervention,
            total_amt=0.00,
            total_amt_local=120000.00,
            actual_amt_local=120000.00,
            actual_amt=120000.00,
            outstanding_amt_local=0.00,
            outstanding_amt=0.00,
            intervention_amt=0.00,
        )

        with self.assertRaisesRegexp(
                TransitionError,
                'Total amount transferred greater than 100,000 and no '
                'Final Partnership Review was attached'):
            transition_to_closed(self.intervention)
        self.expected["total_actual_amt"] = 120000.00
        self.expected["total_actual_amt_usd"] = 120000.00
        self.expected["total_frs_amt"] = 120000.00
        self.expected["earliest_start_date"] = frs.start_date
        self.expected["latest_end_date"] = frs.end_date
        self.assertFundamentals(self.intervention.total_frs)
 def test_end_after_today(self):
     """End date cannot be after today's date'"""
     intervention = InterventionFactory(end=datetime.date.today() +
                                        datetime.timedelta(days=2))
     with self.assertRaisesRegexp(TransitionError,
                                  "End date is in the future"):
         transition_to_closed(intervention)
     self.assertFundamentals(intervention.total_frs)
 def test_end_after_today(self):
     """End date cannot be after today's date'"""
     intervention = InterventionFactory(
         end=datetime.date.today() + datetime.timedelta(days=2)
     )
     with self.assertRaisesRegexp(
             TransitionError,
             "End date is in the future"
     ):
         transition_to_closed(intervention)
     self.assertFundamentals(intervention.total_frs)
 def test_attachment(self):
     """If Total actual amount > 100,000 need attachment with
     type Final Partnership Review
     """
     file_type = self.file_parnership_file_type
     InterventionAttachmentFactory(
         intervention=self.intervention,
         type=file_type
     )
     frs = FundsReservationHeaderFactory(
         intervention=self.intervention,
         total_amt=0.00,
         total_amt_local=120000.00,
         actual_amt_local=120000.00,
         actual_amt=0,
         outstanding_amt_local=0.00,
         outstanding_amt=0.00,
         intervention_amt=0.00,
     )
     self.assertTrue(transition_to_closed(self.intervention))
     self.expected["total_actual_amt"] = 120000.00
     self.expected["total_frs_amt"] = 120000.00
     self.expected["earliest_start_date"] = frs.start_date
     self.expected["latest_end_date"] = frs.end_date
     self.assertFundamentals(self.intervention.total_frs)
Beispiel #6
0
 def test_attachment(self):
     """If Total actual amount > 100,000 need attachment with
     type Final Partnership Review
     """
     file_type = self.file_parnership_file_type
     InterventionAttachmentFactory(
         intervention=self.intervention,
         type=file_type
     )
     frs = FundsReservationHeaderFactory(
         intervention=self.intervention,
         total_amt=0.00,
         total_amt_local=120000.00,
         actual_amt_local=120000.00,
         actual_amt=0,
         outstanding_amt_local=0.00,
         outstanding_amt=0.00,
         intervention_amt=0.00,
     )
     self.assertTrue(transition_to_closed(self.intervention))
     self.expected["total_actual_amt"] = 120000.00
     self.expected["total_frs_amt"] = 120000.00
     self.expected["earliest_start_date"] = frs.start_date
     self.expected["latest_end_date"] = frs.end_date
     self.assertFundamentals(self.intervention.total_frs)
 def test_total_amounts_not_equal(self):
     """Total amounts must equal and total outstanding must be zero"""
     frs = FundsReservationHeaderFactory(intervention=self.intervention,
                                         total_amt=0.00,
                                         total_amt_local=0.00,
                                         intervention_amt=10.00,
                                         actual_amt_local=20.00,
                                         actual_amt=0.00,
                                         outstanding_amt_local=0.00,
                                         outstanding_amt=0.00)
     with self.assertRaisesRegexp(
             TransitionError,
             'Total FR amount needs to equal total actual amount, and '
             'Total Outstanding DCTs need to equal to 0'):
         transition_to_closed(self.intervention)
     self.expected["total_intervention_amt"] = 10.00
     self.expected["total_actual_amt"] = 20.00
     self.expected["earliest_start_date"] = frs.start_date
     self.expected["latest_end_date"] = frs.end_date
     self.assertFundamentals(self.intervention.total_frs)
 def test_total_amounts_not_equal(self):
     """Total amounts must equal and total outstanding must be zero"""
     frs = FundsReservationHeaderFactory(
         intervention=self.intervention,
         total_amt=0.00,
         total_amt_local=0.00,
         intervention_amt=10.00,
         actual_amt_local=20.00,
         actual_amt=0.00,
         outstanding_amt_local=0.00,
         outstanding_amt=0.00
     )
     with self.assertRaisesRegexp(
             TransitionError,
             'Total FR amount needs to equal total actual amount, and '
             'Total Outstanding DCTs need to equal to 0'
     ):
         transition_to_closed(self.intervention)
     self.expected["total_intervention_amt"] = 10.00
     self.expected["total_actual_amt"] = 20.00
     self.expected["earliest_start_date"] = frs.start_date
     self.expected["latest_end_date"] = frs.end_date
     self.assertFundamentals(self.intervention.total_frs)
 def test_total_amounts_valid(self):
     """Total amounts must equal and total outstanding must be zero"""
     frs = FundsReservationHeaderFactory(intervention=self.intervention,
                                         total_amt=0.00,
                                         total_amt_local=10.00,
                                         intervention_amt=0.00,
                                         actual_amt=0.00,
                                         actual_amt_local=10.00,
                                         outstanding_amt=0.00,
                                         outstanding_amt_local=0.00)
     self.assertTrue(transition_to_closed(self.intervention))
     self.expected["total_frs_amt"] = 10.00
     self.expected["total_actual_amt"] = 10.00
     self.expected["earliest_start_date"] = frs.start_date
     self.expected["latest_end_date"] = frs.end_date
     self.assertFundamentals(self.intervention.total_frs)
 def test_dates(self):
     """Ensure earliest and latest dates set correctly"""
     FundsReservationHeaderFactory(
         intervention=self.intervention,
         fr_number=1,
         total_amt=0.00,
         total_amt_local=100.00,
         start_date=datetime.date(2001, 1, 1),
         end_date=datetime.date(2001, 2, 1),
         actual_amt=0.00,
         actual_amt_local=100.00,
         intervention_amt=0.00,
         outstanding_amt_local=0.00,
         outstanding_amt=0.00,
     )
     FundsReservationHeaderFactory(
         intervention=self.intervention,
         fr_number=2,
         total_amt=0.00,
         total_amt_local=100.00,
         start_date=datetime.date(2000, 1, 1),
         end_date=datetime.date(2000, 2, 1),
         actual_amt=0.00,
         actual_amt_local=100.00,
         intervention_amt=0.00,
         outstanding_amt_local=0.00,
         outstanding_amt=0.00,
     )
     FundsReservationHeaderFactory(
         intervention=self.intervention,
         fr_number=3,
         total_amt=0.00,
         total_amt_local=100.00,
         start_date=datetime.date(2002, 1, 1),
         end_date=datetime.date(2002, 2, 1),
         actual_amt_local=100.00,
         actual_amt=0.00,
         intervention_amt=0.00,
         outstanding_amt_local=0.00,
         outstanding_amt=0.00,
     )
     self.assertTrue(transition_to_closed(self.intervention))
     self.expected["earliest_start_date"] = datetime.date(2000, 1, 1)
     self.expected["latest_end_date"] = datetime.date(2002, 2, 1)
     self.expected["total_actual_amt"] = 300.00
     self.expected["total_frs_amt"] = 300.00
     self.assertFundamentals(self.intervention.total_frs)
 def test_dates(self):
     """Ensure earliest and latest dates set correctly"""
     FundsReservationHeaderFactory(
         intervention=self.intervention,
         fr_number=1,
         total_amt=0.00,
         total_amt_local=100.00,
         start_date=datetime.date(2001, 1, 1),
         end_date=datetime.date(2001, 2, 1),
         actual_amt=0.00,
         actual_amt_local=100.00,
         intervention_amt=0.00,
         outstanding_amt_local=0.00,
         outstanding_amt=0.00,
     )
     FundsReservationHeaderFactory(
         intervention=self.intervention,
         fr_number=2,
         total_amt=0.00,
         total_amt_local=100.00,
         start_date=datetime.date(2000, 1, 1),
         end_date=datetime.date(2000, 2, 1),
         actual_amt=0.00,
         actual_amt_local=100.00,
         intervention_amt=0.00,
         outstanding_amt_local=0.00,
         outstanding_amt=0.00,
     )
     FundsReservationHeaderFactory(
         intervention=self.intervention,
         fr_number=3,
         total_amt=0.00,
         total_amt_local=100.00,
         start_date=datetime.date(2002, 1, 1),
         end_date=datetime.date(2002, 2, 1),
         actual_amt_local=100.00,
         actual_amt=0.00,
         intervention_amt=0.00,
         outstanding_amt_local=0.00,
         outstanding_amt=0.00,
     )
     self.assertTrue(transition_to_closed(self.intervention))
     self.expected["earliest_start_date"] = datetime.date(2000, 1, 1)
     self.expected["latest_end_date"] = datetime.date(2002, 2, 1)
     self.expected["total_actual_amt"] = 300.00
     self.expected["total_frs_amt"] = 300.00
     self.assertFundamentals(self.intervention.total_frs)
 def test_total_frs_amount(self):
     """Ensure total_frs_amt set correctly"""
     frs = FundsReservationHeaderFactory(
         intervention=self.intervention,
         total_amt=0.00,
         total_amt_local=100.00,
         actual_amt=0.00,
         actual_amt_local=100.00,
         intervention_amt=0.00,
         outstanding_amt=0.00,
         outstanding_amt_local=0.00,
     )
     self.assertTrue(transition_to_closed(self.intervention))
     self.expected["total_frs_amt"] = 100.00
     self.expected["total_actual_amt"] = 100.00
     self.expected["earliest_start_date"] = frs.start_date
     self.expected["latest_end_date"] = frs.end_date
     self.assertFundamentals(self.intervention.total_frs)
 def test_total_amounts_valid(self):
     """Total amounts must equal and total outstanding must be zero"""
     frs = FundsReservationHeaderFactory(
         intervention=self.intervention,
         total_amt=0.00,
         total_amt_local=10.00,
         intervention_amt=0.00,
         actual_amt=0.00,
         actual_amt_local=10.00,
         outstanding_amt=0.00,
         outstanding_amt_local=0.00
     )
     self.assertTrue(transition_to_closed(self.intervention))
     self.expected["total_frs_amt"] = 10.00
     self.expected["total_actual_amt"] = 10.00
     self.expected["earliest_start_date"] = frs.start_date
     self.expected["latest_end_date"] = frs.end_date
     self.assertFundamentals(self.intervention.total_frs)
 def test_total_frs_amount(self):
     """Ensure total_frs_amt set correctly"""
     frs = FundsReservationHeaderFactory(
         intervention=self.intervention,
         total_amt=0.00,
         total_amt_local=100.00,
         actual_amt=0.00,
         actual_amt_local=100.00,
         intervention_amt=0.00,
         outstanding_amt=0.00,
         outstanding_amt_local=0.00,
     )
     self.assertTrue(transition_to_closed(self.intervention))
     self.expected["total_frs_amt"] = 100.00
     self.expected["total_actual_amt"] = 100.00
     self.expected["earliest_start_date"] = frs.start_date
     self.expected["latest_end_date"] = frs.end_date
     self.assertFundamentals(self.intervention.total_frs)