def test_mid_generate_periodic_target_single(self):
     """Do we get back the expected result when we have an MID_END?"""
     tf = Indicator.MID_END
     expected = [{'period': 'Midline'}, {'period': 'Endline'}]
     result = generate_periodic_target_single(tf,
                                              self.start_date,
                                              self.nth_target_period,
                                              event_name=self.event_name)
     self.assertEqual(expected, result)
 def test_event_generate_periodic_target_single(self):
     """Do we get back the expected result when we have an EVENT?"""
     tf = Indicator.EVENT
     expected = {'period': self.event_name, 'period_name': self.event_name}
     result = generate_periodic_target_single(tf,
                                              self.start_date,
                                              0,
                                              event_name=self.event_name)
     self.assertEqual(expected, result)
 def test_lop_generate_periodic_target_single(self):
     """Do we get back the expected result when we have an LOP?"""
     tf = Indicator.LOP
     expected = {'period': "Life of Program (LoP) only"}
     result = generate_periodic_target_single(tf,
                                              self.start_date,
                                              self.nth_target_period,
                                              event_name=self.event_name)
     self.assertDictEqual(expected, result)
    def test_tri_annual(self):
        tf = Indicator.TRI_ANNUAL
        # TODO: Get clarification on the business rules for this function
        expected = {
            'end_date': '2022-06-04',
            'period': 'Tri-annual period 11',
            'start_date': '2022-02-01'
        }

        result = generate_periodic_target_single(tf,
                                                 self.start_date,
                                                 self.nth_target_period,
                                                 event_name='')
        self.assertDictEqual(expected, result)
    def test_quarterly(self):
        tf = Indicator.QUARTERLY

        # TODO: Get clarification on the business rules for this function
        expected = {
            'end_date': '2021-07-04',
            'period': 'Quarter 11',
            'start_date': '2021-04-01'
        }

        result = generate_periodic_target_single(tf,
                                                 self.start_date,
                                                 self.nth_target_period,
                                                 event_name='')
        self.assertDictEqual(expected, result)
    def test_monthly(self):
        tf = Indicator.MONTHLY

        # TODO: Get clarification on the business rules for this function
        expected = {
            'end_date': '2019-09-04',
            'period': 'August 2019',
            'start_date': '2019-08-01'
        }

        result = generate_periodic_target_single(tf,
                                                 self.start_date,
                                                 self.nth_target_period,
                                                 event_name='')
        self.assertDictEqual(expected, result)
    def test_tri_annual(self):
        """Do we get the correct period name back for TRI_ANNUAL frequency"""

        tf = Indicator.TRI_ANNUAL
        expected = {
            'end_date': '2022-06-04',
            'period': 'Tri-annual period 11',
            'start_date': '2022-02-01',
            'period_name': u'Tri-annual period 11',
        }

        result = generate_periodic_target_single(tf,
                                                 self.start_date,
                                                 self.nth_target_period,
                                                 event_name='')
        self.assertDictEqual(expected, result)
    def test_annual(self):
        """Do we get back the correct period name back for ANNUAL frequency"""

        tf = Indicator.ANNUAL
        expected = {
            'period': 'Year 11',
            'end_date': '2029-10-04',
            'start_date': '2028-10-01',
            'period_name': u'Year 11',
        }

        result = generate_periodic_target_single(tf,
                                                 self.start_date,
                                                 self.nth_target_period,
                                                 event_name='')
        self.assertDictEqual(expected, result)
    def test_monthly(self):
        """Do we get the correct period name back for MONTHLY frequency"""

        tf = Indicator.MONTHLY
        expected = {
            'end_date': '2019-09-04',
            'period': 'August 2019',
            'start_date': '2019-08-01',
            'period_name': u'August 2019',
        }

        result = generate_periodic_target_single(tf,
                                                 self.start_date,
                                                 self.nth_target_period,
                                                 event_name='')
        self.assertDictEqual(expected, result)
    def test_quarterly(self):
        """Do we get the correct period name back for QUARTERLY frequency"""

        tf = Indicator.QUARTERLY
        expected = {
            'end_date': '2021-07-04',
            'period': 'Quarter 11',
            'start_date': '2021-04-01',
            'period_name': u'Quarter 11',
        }

        result = generate_periodic_target_single(tf,
                                                 self.start_date,
                                                 self.nth_target_period,
                                                 event_name='')
        self.assertDictEqual(expected, result)
    def test_annual(self):
        """Do we get back the correct value if it is ANNUAL"""

        tf = Indicator.ANNUAL
        # TODO: Get clarification on the business rules for this function
        expected = {
            'period': 'Year 11',
            'end_date': '2029-10-04',
            'start_date': '2028-10-01'
        }

        result = generate_periodic_target_single(tf,
                                                 self.start_date,
                                                 self.nth_target_period,
                                                 event_name='')
        self.assertDictEqual(expected, result)