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_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_change_details_provider(self): provider = healthSystem.get_user_byName("Anna Azzam") assert (provider.name == "Anna Azzam") assert (provider.email == "*****@*****.**") assert (provider.phone == "0412 009 200") healthSystem.editDetails(provider, "Dom Latouche", "*****@*****.**", "0419 243 333") assert (provider.name == "Dom Latouche") assert (provider.email == "*****@*****.**") assert (provider.phone == "0419 243 333")
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_provider_phone_empty(self): provider = healthSystem.get_user_byName("Anna Azzam") assert (provider.name == "Anna Azzam") assert (provider.email == "*****@*****.**") assert (provider.phone == "0412 009 200") try: healthSystem.editDetails(provider, "Owen Silver", "*****@*****.**", "") except EditError as ee: assert (ee.errors["phone"] == "Please enter a valid phone.") assert (provider.name == "Anna Azzam") assert (provider.email == "*****@*****.**") assert (provider.phone == "0412 009 200") else: assert (false)
def test_change_details_provider_email_empty(self): provider = healthSystem.get_user_byName("Anna Azzam") assert (provider.name == "Anna Azzam") assert (provider.email == "*****@*****.**") assert (provider.phone == "0412 009 200") try: healthSystem.editDetails(provider, "", "*****@*****.**", "1231 231 123") except EditError as ee: assert (ee.errors["name"] == "Please enter a valid name.") assert (provider.name == "Anna Azzam") assert (provider.email == "*****@*****.**") assert (provider.phone == "0412 009 200") 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)