Пример #1
0
def test_provider_multiple_booking_same_time():
    UM = system.get_UserManager()
    patient1 = UM.get_patient("*****@*****.**")
    patient2 = UM.get_patient("*****@*****.**")
    HCP = UM.get_HCP("*****@*****.**")
    locations = HCP.get_aff_HCC_centers
    HCC = locations[0]
    BM = bookingManager()
    booking1 = BM.createBooking("17:00", "2019-02-10", HCP._email,
                                patient1._email, HCC, patient1)
    BM.append_to_user(booking1, HCP, patient1)
    for booking in BM._bookings:
        print(booking._time)
        print(booking._date)

    try:
        booking = BM.createBooking("17:00", "2019-02-10", HCP._email,
                                   patient2._email, HCC, patient2)
        BM.append_to_user(booking, HCP, patient1)
        assert (False)
    except BookingError as e:
        assert (
            e._error_message ==
            "Sorry. The provider is booked at this time. Please select another time or a different provider"
        )
Пример #2
0
def test_empty_time():
    UM = system.get_UserManager()
    patient = UM.get_patient("*****@*****.**")
    HCP = UM.get_HCP("*****@*****.**")
    date = "2019-10-10"
    time = ""
    locations = HCP.get_aff_HCC_centers
    HCC = locations[0]
    BM = bookingManager()
    try:
        booking = BM.createBooking(time, date, HCP._email, patient._email, HCC,
                                   patient)
        assert (False)
    except BookingError as e:
        assert (e._error_message == "Please select a valid time")
Пример #3
0
def test_provider_can_book_as_patient():
    UM = system.get_UserManager()
    patient = UM.get_patient("*****@*****.**")
    HCP = UM.get_HCP("*****@*****.**")
    locations = HCP.get_aff_HCC_centers
    HCC = locations[0]
    BM = bookingManager()

    try:
        booking = BM.createBooking("17:00", "2019-05-10", HCP._email,
                                   patient._email, HCC, patient)
        BM.append_to_user(booking, HCP, patient)
        assert (True)
    except BookingError as e:
        assert (e is not defined)
Пример #4
0
def test_valid_date():
    UM = system.get_UserManager()
    patient = UM.get_patient("*****@*****.**")
    HCP = UM.get_HCP("*****@*****.**")
    date = "2019-10-10"
    time = "9:30"
    locations = HCP.get_aff_HCC_centers
    HCC = locations[0]
    BM = bookingManager()
    try:
        booking = BM.createBooking(time, date, HCP._email, patient._email, HCC,
                                   patient)
        assert (True)
    except BookingError as e:
        assert (e is not defined)
Пример #5
0
def test_provider_restriction():
    UM = system.get_UserManager()
    HCP = UM.get_HCP("*****@*****.**")
    locations = HCP.get_aff_HCC_centers
    HCC = locations[0]
    BM = bookingManager()

    try:
        booking = BM.createBooking("17:00", "2019-02-10", HCP._email,
                                   HCP._email, HCC, HCP)
        assert (False)
    except BookingError as e:
        assert (
            e._error_message ==
            "A provider is not allowed to make bookings. Please login as a patient to make bookings"
        )
Пример #6
0
def test_provider_multiple_booking_different_time():
    UM = system.get_UserManager()
    patient = UM.get_patient("*****@*****.**")
    HCP = UM.get_HCP("*****@*****.**")
    locations = HCP.get_aff_HCC_centers
    HCC = locations[0]
    BM = bookingManager()
    booking1 = BM.createBooking("16:00", "2019-02-10", HCP._email,
                                patient._email, HCC, patient)
    BM.append_to_user(booking1, HCP, patient)

    try:
        booking = BM.createBooking("15:30", "2019-03-10", HCP._email,
                                   patient._email, HCC, patient)
        assert (True)
    except BookingError as e:
        assert (e is not defined)
Пример #7
0
def test_provider_cannot_book_themselves():
    UM = system.get_UserManager()
    patient = UM.get_patient("*****@*****.**")
    HCP = UM.get_HCP("*****@*****.**")
    locations = HCP.get_aff_HCC_centers
    HCC = locations[0]
    BM = bookingManager()

    try:
        booking = BM.createBooking("18:00", "2019-05-10", HCP._email,
                                   patient._email, HCC, patient)
        BM.append_to_user(booking, HCP, patient)
        assert (False)
    except BookingError as e:
        assert (
            e._error_message ==
            "Sorry. A provider is not able to make an appointment with themselves"
        )
Пример #8
0
def test_patient_multiple_booking_same_time():
    UM = system.get_UserManager()
    patient = UM.get_patient("*****@*****.**")
    HCP = UM.get_HCP("*****@*****.**")
    locations = HCP.get_aff_HCC_centers
    HCC = locations[0]
    BM = bookingManager()
    booking1 = BM.createBooking("15:30", "2019-11-10", HCP._email,
                                patient._email, HCC, patient)
    BM.append_to_user(booking1, HCP, patient)

    try:
        booking = BM.createBooking("15:30", "2019-11-10", HCP._email,
                                   patient._email, HCC, patient)
        assert (False)
    except BookingError as e:
        assert (e._error_message ==
                "Sorry. You cannot book two appointments at the same time")
Пример #9
0
def test_patient_multiple_booking_different_times():
    UM = system.get_UserManager()
    patient = UM.get_patient("*****@*****.**")
    HCP = UM.get_HCP("*****@*****.**")
    date = "2019-10-10"
    time = "9:30"
    locations = HCP.get_aff_HCC_centers
    HCC = locations[0]
    BM = bookingManager()
    time2 = "10:30"
    try:
        booking = BM.createBooking(time, date, HCP._email, patient._email, HCC,
                                   patient)
        BM.append_to_user(booking, HCP, patient)
        booking2 = BM.createBooking(time2, date, HCP._email, patient._email,
                                    HCC, patient)
        assert (True)
    except BookingError as e:
        assert (e is not defined)
def test_unauthorised_provider_note():
    # anna cannot make add any notes to do with the appointment between jack and toby

    UM = system.get_UserManager()
    patient = UM.get_patient('*****@*****.**')
    HCP1 = UM.get_HCP('*****@*****.**')
    dateA = "2019-10-15"
    timeA = "9:30"
    locations = HCP1.get_aff_HCC_centers
    HCC_A = locations[0]
    BM = bookingManager()
    booking1 = BM.createBooking(timeA, dateA, HCP1._email, patient._email,
                                HCC_A, patient)

    HCP2 = UM.get_HCP('*****@*****.**')
    dateB = '2019-10-16'
    timeB = '9:30'
    locations = HCP2.get_aff_HCC_centers
    HCC_B = locations[0]
    booking2 = BM.createBooking(timeB, dateB, HCP2._email, patient._email,
                                HCC_B, patient)

    try:
        booking1.can_add_dNote('*****@*****.**')
        assert (False)
    except UnauthorisedAccess as error:
        assert (error.get_message() ==
                "You are not authorised to access this page")

    #toby is authorised to add a note
    try:
        booking1.can_add_dNote('*****@*****.**')
    except UnauthorisedAccess as error:
        assert (False)

    #another patient cannot add a note
    try:
        booking1.can_add_dNote('*****@*****.**')
        assert (False)
    except UnauthorisedAccess as error:
        assert (error.get_message() ==
                "You are not authorised to access this page")
Пример #11
0
def test_date_and_time():
    UM = system.get_UserManager()
    patient = UM.get_patient("*****@*****.**")
    HCP = UM.get_HCP("*****@*****.**")
    date = datetime.now().strftime("%Y-%m-%d")
    print(date)
    future_time = datetime.now() - timedelta(minutes=30)
    time = future_time.strftime('%H:%M')
    print(time)
    locations = HCP.get_aff_HCC_centers
    HCC = locations[0]
    BM = bookingManager()
    try:
        booking = BM.createBooking(time, date, HCP._email, patient._email, HCC,
                                   patient)
        assert (False)
    except BookingError as e:
        print(e._error_message)
        assert (e._error_message ==
                "Please select a time and date that is not in the past")
def patient_appointments():

    UM = system.get_UserManager()
    patient = UM.get_patient('*****@*****.**')
    HCP = UM.get_HCP('*****@*****.**')
    date = "2019-10-15"
    time = "9:30"
    locations = HCP.get_aff_HCC_centers
    HCC = locations[0]
    BM = bookingManager()
    booking = BM.createBooking(time, date, HCP._email, patient._email, HCC,
                               patient)
    unauthorised_HCP = UM.get_HCP('*****@*****.**')

    #anna cannot access jack's appointments because jack is not her patient
    try:
        patient.can_view_appointments(unauthorised_HCP)
        assert (False)
    except UnauthorisedAccess as error:
        assert (error.get_message() ==
                "You are not authorised to access this page")

    #HCP toby should be able to access jacks list of past appointments
    try:
        patient.can_view_appointments(HCP)
    except UnauthorisedAccess as error:
        assert (False)

    #another patient cannot access jacks list of past appointments
    hao = UM.get_patient('*****@*****.**')
    try:
        patient.can_view_appointments(hao)
        assert (False)
    except UnauthorisedAccess as error:
        assert (error.get_message() ==
                "You are not authorised to access this page")