Ejemplo n.º 1
0
 def test_process_datafiles(self, mock_read):
     points = update_ipeds.DATA_POINTS
     school_points = update_ipeds.NEW_SCHOOL_DATA_POINTS
     mock_return_dict = {points[key]: 'x' for key in points}
     mock_return_dict['UNITID'] = '999999'
     mock_return_dict['ROOM'] = '1'
     mock_fieldnames = ['UNITID', 'ROOM'] + list(points.keys())
     mock_read.return_value = (mock_fieldnames, [mock_return_dict])
     mock_results = update_ipeds.process_datafiles()
     self.assertTrue(mock_read.call_count == 2)
     self.assertTrue('999999' in mock_results.keys())
     mock_fieldnames = ['UNITID'] + list(school_points.keys())
     mock_return_dict = {school_points[key]: 'x' for key in school_points}
     mock_return_dict['UNITID'] = '999999'
     mock_read.return_value = (mock_fieldnames, [mock_return_dict])
     mock_results = update_ipeds.process_datafiles(add_schools=['999999'])
     self.assertTrue(mock_read.call_count == 3)
Ejemplo n.º 2
0
 def test_process_datafiles(self, mock_read):
     points = update_ipeds.DATA_POINTS
     school_points = update_ipeds.NEW_SCHOOL_DATA_POINTS
     mock_return_dict = {points[key]: 'x' for key in points}
     mock_return_dict['UNITID'] = '999999'
     mock_return_dict['ROOM'] = '1'
     mock_fieldnames = ['UNITID', 'ROOM'] + points.keys()
     mock_read.return_value = (mock_fieldnames, [mock_return_dict])
     mock_dict = update_ipeds.process_datafiles()
     self.assertTrue(mock_read.call_count == 2)
     self.assertTrue('999999' in mock_dict.keys())
     mock_fieldnames = ['UNITID'] + school_points.keys()
     mock_return_dict = {school_points[key]: 'x' for key in school_points}
     mock_return_dict['UNITID'] = '999999'
     mock_read.return_value = (mock_fieldnames, [mock_return_dict])
     mock_dict = update_ipeds.process_datafiles(add_schools=['999999'])
     self.assertTrue(mock_read.call_count == 3)