Exemple #1
0
 def test_delete_all_patients(self):
     repo = PatientRepository()
     patient1 = Patients("A", "AA", 111, "flu")
     patient2 = Patients("B", "BB", 124, "flu")
     patient3 = Patients("C", "L", 90, "Zika")
     repo.add_patient(patient1)
     repo.add_patient(patient2)
     repo.add_patient(patient3)
     repo.delete_all_patients()
     self.assertEqual(repo.get_size(), 0)
    def add_patients_to_department(self, patients, department):
        """

        :param patients: a parameter of type PatientsRepository
        :param department: a parameter of type department read by the user
        """
        i = self.get_index(department)
        if 0 > i > self.get_size_department():
            raise ValueError("The department does not exist")
        p = PatientRepository()
        p.delete_all_patients()
        for el in patients.get_all():
            p.add_patient(el)
        self.__department[i].set_patients(p)
Exemple #3
0
 def test_update_patients_from_department(self):
     repo1 = DepartmentsRepository()
     department1 = Departments(1, "flue", 4)
     repo1.add_department(department1)
     repo2 = PatientRepository()
     patient1 = Patients("A", "B", 111, "flu")
     patient2 = Patients("B", "C", 234, "flu")
     patient3 = Patients("C", "D", 2, "flu")
     patient4 = Patients("L", "K", 0, "Zika")
     repo2.add_patient(patient1)
     repo2.add_patient(patient2)
     repo2.add_patient(patient3)
     repo2.delete_all_patients()
     repo2.add_patient(patient4)
     repo1.update_patients_from_department(department1, repo2)
     self.assertEqual(department1.get_patients().get_size(), 0)