def test_get_all_results(self): with open(dbc.DB_FILE_PATH, "r+") as f: f.truncate() to_save = dbc.Specialization() to_save.capacity = 92 to_save.name = "new specialization" to_save.identifier = 0 result = dbc.save_specialization(to_save) to_save1 = dbc.AdmissionResult() to_save1.candidate_cnp = 987654321 to_save1.allocation = dbc.AdmissionStatus.FEE to_save1.specialization_id = 0 to_save1.final_score = 8.6 to_save2 = dbc.AdmissionResult() to_save2.candidate_cnp = 1234567 to_save2.allocation = dbc.AdmissionStatus.FREE to_save2.specialization_id = 0 to_save2.final_score = 9.0 dbc.save_admission_result_for_candidate(to_save1) dbc.save_admission_result_for_candidate(to_save2) found = dbc.get_admission_results() self.assertEqual(2, len(found)) found = dbc.get_admission_results(1) self.assertEqual(2, len(found))
def test_save_duplicate_admission(self): with open(dbc.DB_FILE_PATH, "r+") as f: f.truncate() to_save = dbc.AdmissionResult() to_save.candidate_cnp = 987654321 to_save.allocation = dbc.AdmissionStatus.FEE to_save.specialization_id = 0 to_save.final_score = 8.6 dbc.save_admission_result_for_candidate(to_save) result = dbc.save_admission_result_for_candidate(to_save) saved = dbc.get_admission_results() self.assertEqual(1, len(saved)) self.assertEqual('OK', result)
def get_results(): all_results = DbC.get_admission_results(1) return all_results