def um_fixture(centre_fixture): um = UserManager() um.add_patient_by_info("*****@*****.**", "pwd", "Goldstein", "Mark", "126578445") um.add_provider_by_info("*****@*****.**", "pwd", "smith", "john", 123, "GP") provider = um.get_user("*****@*****.**") provider.add_centre(centre_fixture[0].name) return um
def test_remove_existing_patient(): um = UserManager() um.add_patient_by_info('*****@*****.**', 'password', 'Cena', 'John', '04253634223') assert (len(um.patients) == 1) assert (um.patients[0].email == '*****@*****.**') assert (um.get_user('*****@*****.**') is not None) assert (um.remove_patient('*****@*****.**')) assert (um.patients == []) assert (um.get_service_names() == [])
def test_add_new_patient(): um = UserManager() assert (um.patients == []) cond = um.add_patient_by_info('*****@*****.**', 'password', 'Cena', 'John', '02141244235') assert (cond == True) assert (len(um.patients) == 1) assert (um.patients[0].email == '*****@*****.**')
def test_remove_non_existing_patient(): um = UserManager() um.add_patient_by_info('*****@*****.**', 'password', 'Cena', 'John', '04253634223') assert (not um.remove_patient('*****@*****.**')) assert (um.patients[0].email == '*****@*****.**')
def test_add_existing_patient(): um = UserManager() um.add_patient_by_info('1', '1', '1', '1', '1') um.add_patient_by_info('1', '1', '1', '1', '1') assert (len(um.patients) == 1)