def test_patient_authorised_list(self): provider = healthSystem.get_user_byName("Toby Morgan") centre = healthSystem.getCentreWithID("1111") patient = healthSystem.get_user("*****@*****.**") date = "2018-11-25" time = healthSystem.getAvailableHours(provider, centre, date)[0] #9:00am notes = "Jack is going to die" assert (len(patient.bookings) == 0) booking1 = healthSystem.makeBooking(time, centre, provider, patient, date) booking1.addANote(notes) provider = healthSystem.get_user_byName("Anna Azzam") centre = healthSystem.getCentreWithID("1111") patient = healthSystem.get_user("*****@*****.**") date = "2018-11-25" time = healthSystem.getAvailableHours(provider, centre, date)[0] notes = "Jack is looking pretty good" booking2 = healthSystem.makeBooking(time, centre, provider, patient, date) booking2.addANote(notes) assert (patient.authorisedUsers == [ healthSystem.get_user_byName("Toby Morgan"), healthSystem.get_user_byName("Anna Azzam") ])
def test_view_all_notes(self): provider = healthSystem.get_user_byName("Toby Morgan") centre = healthSystem.getCentreWithID("1111") patient = healthSystem.get_user("*****@*****.**") date = "2018-11-25" time = healthSystem.getAvailableHours(provider, centre, date)[0] #9:00am notes = "Jack is going to die..." booking1 = healthSystem.makeBooking(time, centre, provider, patient, date) booking1.addANote(notes) provider = healthSystem.get_user_byName("Anna Azzam") centre = healthSystem.getCentreWithID("1111") patient = healthSystem.get_user("*****@*****.**") date = "2018-11-25" time = healthSystem.getAvailableHours(provider, centre, date)[0] #9:00am notes = "if he doesn't take a panadol right now" booking2 = healthSystem.makeBooking(time, centre, provider, patient, date) booking2.addANote(notes) allpatientnotes = "" for abooking in patient.bookings: allpatientnotes = allpatientnotes + abooking.notes assert ( allpatientnotes == "Jack is going to die...if he doesn't take a panadol right now")
def test_availableHours(self): provider = healthSystem.get_user_byName("Toby Morgan") #Toby Morgan centre = healthSystem.getCentreWithID( "1111") #Sydney Childrens Hospital patient = healthSystem.get_user("*****@*****.**") date = "2018-11-25" time = healthSystem.getAvailableHours(provider, centre, date)[0] #9:00am AvailableHoursBookedProvider = len( healthSystem.getAvailableHours(provider, centre, date)) otherProvider = healthSystem.get_user_byName("Anna Azzam") AvailableHoursOtherProvider = len( healthSystem.getAvailableHours(otherProvider, centre, date)) booking1 = healthSystem.makeBooking(time, centre, provider, patient, date) assert (booking1.time == "9:00am") assert (booking1.provider.name == "Toby Morgan") assert (booking1.date == "2018-11-25") assert ((len(healthSystem.getAvailableHours( provider, centre, date))) == (AvailableHoursBookedProvider - 1)) #asserts that the available hours of this provider has gone down by 1 assert (len(healthSystem.getAvailableHours( otherProvider, centre, date)) == AvailableHoursOtherProvider)
def test_change_details_patients(self): patient = healthSystem.get_user("*****@*****.**") assert (patient.name == "Jack Bilby") assert (patient.email == "*****@*****.**") assert (patient.phone == "0420 008 080") healthSystem.editDetails(patient, "Owen Silver", "*****@*****.**", "0427 169 346") assert (patient.name == "Owen Silver") assert (patient.email == "*****@*****.**") assert (patient.phone == "0427 169 346")
def test_bookingHistoryBeforeAppointment(self): provider = healthSystem.get_user_byName("Toby Morgan") centre = healthSystem.getCentreWithID("1111") patient = healthSystem.get_user("*****@*****.**") date = "2018-11-25" time = healthSystem.getAvailableHours(provider, centre, date)[0] #9:00am notes = "Jack is going to die" booking1 = healthSystem.makeBooking(time, centre, provider, patient, date) assert (booking1.completed == False)
def test_viewNotes(self): provider = healthSystem.get_user_byName("Toby Morgan") centre = healthSystem.getCentreWithID("1111") patient = healthSystem.get_user("*****@*****.**") date = "2018-11-25" time = healthSystem.getAvailableHours(provider, centre, date)[0] #9:00am notes = "Jack is going to die" booking1 = healthSystem.makeBooking(time, centre, provider, patient, date) booking1.addANote(notes) assert (booking1.notes == "Jack is going to die")
def test_makevalidbooking(self): provider = healthSystem.get_user_byName("Toby Morgan") #Toby Morgan centre = healthSystem.getCentreWithID("1111") patient = healthSystem.get_user("*****@*****.**") date = "2018-11-25" time = healthSystem.getAvailableHours(provider, centre, date)[0] #9:00am booking1 = healthSystem.makeBooking(time, centre, provider, patient, date) assert (booking1.time == "9:00am") assert (booking1.provider.name == "Toby Morgan") assert (booking1.date == "2018-11-25")
def test_change_details_patients_phone_empty(self): patient = healthSystem.get_user("*****@*****.**") assert (patient.name == "Jack Bilby") assert (patient.email == "*****@*****.**") assert (patient.phone == "0420 008 080") try: healthSystem.editDetails(patient, "Owen Silver", "*****@*****.**", "") except EditError as ee: assert (ee.errors["phone"] == "Please enter a valid phone.") assert (patient.name == "Jack Bilby") assert (patient.email == "*****@*****.**") assert (patient.phone == "0420 008 080") else: assert (false)
def test_invalid_booking_in_past(self): provider = healthSystem.get_user_byName("Toby Morgan") #Toby Morgan centre = healthSystem.getCentreWithID("1111") patient = healthSystem.get_user("*****@*****.**") date = "2018-05-05" time = healthSystem.getAvailableHours(provider, centre, date)[0] #9:00am try: booking1 = healthSystem.makeBooking(time, centre, provider, patient, date) except BookingError as be: assert ( be.error == "Cannot book an appointment in the past. Choose another date.") else: assert (False)
def test_patient_booking_history(self): provider = healthSystem.get_user_byName("Toby Morgan") centre = healthSystem.getCentreWithID("1111") patient = healthSystem.get_user("*****@*****.**") date = "2018-11-25" time = healthSystem.getAvailableHours(provider, centre, date)[0] #9:00am notes = "Jack is going to die" assert (len(patient.bookings) == 0) booking1 = healthSystem.makeBooking(time, centre, provider, patient, date) booking1.addANote(notes) assert (len(patient.bookings) == 1) assert (patient.bookings[0].date == "2018-11-25") assert (patient.bookings[0].provider == provider) assert (patient.bookings[0].notes == "Jack is going to die") booking1 = healthSystem.makeBooking(time, centre, provider, patient, date)