def test_data_fetching_retrieving_first_record_for_multiple_nhnds_per_month_per_awc(
            self):
        """
        test tp check if the first record is getting retrieved if there are multiple vhnds per month per awc
        """
        limit = GOVERNANCE_API_RECORDS_PAGINATION
        query_filters = {'state_id': 'st2', 'awc_launched': True}
        order = ['awc_id']
        data, count = get_vhnd_data(limit, 2017, 5, order, query_filters)
        expected_row = {
            "awc_id": "a22",
            "awc_code": "a22",
            "vhsnd_conducted": "yes",
            "vhsnd_date": datetime.date(2017, 5, 16),
            "anm_present": "yes",
            "asha_present": "yes",
            "any_child_immunized": "yes",
            "anc_conducted": "yes"
        }
        expected_counter = 1
        actual_row = None
        counter = 0
        for row in data:
            if row['awc_id'] == 'a22':
                actual_row = row
                counter += 1

        self.assertEqual(counter, expected_counter)
        self.assertEqual(actual_row, expected_row)
 def test_data_fetching_total_record_count_for_vhnds_visit_api(self):
     """
     test to check the total count of records that are returned from the vhnds api
     """
     limit = GOVERNANCE_API_RECORDS_PAGINATION
     query_filters = {'state_id': 'st1', 'awc_launched': True}
     order = ['awc_id']
     data, count = get_vhnd_data(limit, 2017, 5, order, query_filters)
     expected_count = 10
     self.assertEqual(count, expected_count)
Пример #3
0
 def test_data_fetching_total_record_count_for_no_records_for_vhnds_api(
         self):
     """
     test to check the no records are returned from the vhnds api
     """
     limit = GOVERNANCE_API_PAGE_SIZE
     query_filters = {'state_id': 'st1', 'awc_launched': True}
     order = ['awc_id']
     data, count = get_vhnd_data(limit, 2018, 6, order, query_filters)
     expected_count = 0
     self.assertEqual(count, expected_count)
     self.assertEqual(data, [])
 def test_data_fetching_without_start_for_vhnds_api(self):
     """
     test to check the first record that is returned from the vhnds api without start parameter
     """
     limit = GOVERNANCE_API_RECORDS_PAGINATION
     query_filters = {'state_id': 'st1', 'awc_launched': True}
     order = ['awc_id']
     data, count = get_vhnd_data(limit, 2017, 5, order, query_filters)
     expected_first_row = {
         "awc_id": "a10",
         "awc_code": "a10",
         "vhsnd_conducted": "no",
         "vhsnd_date": "Data Not Entered",
         "anm_present": "Data Not Entered",
         "asha_present": "Data Not Entered",
         "any_child_immunized": "Data Not Entered",
         "anc_conducted": "Data Not Entered"
     }
     self.assertEqual(data[0], expected_first_row)
Пример #5
0
 def test_data_fetching_with_start_for_vhnds_api(self):
     """
     test to check the first record that is returned from the vhnds api with start parameter
     """
     limit = GOVERNANCE_API_PAGE_SIZE
     query_filters = {
         'state_id': 'st1',
         'awc_id__gt': 'a41',
         'awc_launched': True
     }
     order = ['awc_id']
     data, count = get_vhnd_data(limit, 2017, 5, order, query_filters)
     expected_first_row = {
         "awc_id": "a43",
         "awc_code": "a43",
         "vhsnd_conducted": "no",
         "vhsnd_date": None,
         "anm_present": None,
         "asha_present": None,
         "children_immunized": None,
         "anc_conducted": None
     }
     self.assertEqual(data[0], expected_first_row)