예제 #1
0
    def test_calc_age_returns_none_if__both_dates_missing(self):
        examination_overview = ExaminationOverview(
            ExaminationMocks.get_case_index_response_content()['examinations']
            [0])
        examination_overview.date_of_birth = None
        examination_overview.date_of_death = None
        result = examination_overview.calc_age()

        self.assertIsNone(result)
예제 #2
0
 def test_calc_age_returns_none_if_date_of_death_missing(self):
     examination_overview = ExaminationOverview(
         ExaminationMocks.get_case_index_response_content()['examinations']
         [0])
     birth_date = '2019-02-02T02:02:02.000Z'
     examination_overview.date_of_birth = parse_datetime(birth_date)
     examination_overview.date_of_death = None
     result = examination_overview.calc_age()
     self.assertIsNone(result)
예제 #3
0
 def test_calc_age_correctly_calculates_the_age_if_dates_present(self):
     examination_overview = ExaminationOverview(
         ExaminationMocks.get_case_index_response_content()['examinations']
         [0])
     birth_date = '2018-02-02T02:02:02.000Z'
     death_date = '2019-02-02T02:02:02.000Z'
     examination_overview.date_of_birth = parse_datetime(birth_date)
     examination_overview.date_of_death = parse_datetime(death_date)
     result = examination_overview.calc_age()
     expected_age = 1
     self.assertEqual(result, expected_age)
예제 #4
0
    def test_card_presenter_returns_a_correctly_formatted_dod_if_date_present(
            self):
        examination_overview = ExaminationOverview(
            ExaminationMocks.get_case_index_response_content()['examinations']
            [0])

        given_date = '2019-02-02T02:02:02.000Z'
        examination_overview.date_of_death = parse_datetime(given_date)

        presenter = case_card_presenter(examination_overview)
        result = presenter['banner_dod']
        expected_date = '02.02.2019'
        self.assertEqual(result, expected_date)