コード例 #1
0
    def test_successful_appointment_2(self):
        print("test_successful_booking_appointment_2")

        providerObj = system.get_provider("*****@*****.**")
        assert (providerObj.is_provider() == True)

        centreObj = system.get_centre("USYD Health Service")
        assert (centreObj.is_centre() == True)

        userObj = system.get_patient("*****@*****.**")
        assert (userObj.is_provider() == False)

        datetimeObj = datetime.datetime(2018, 1, 1, 10, 30)
        note = "I'm dying, please help me doctor!"
        referral_id = 0

        apmt = system.add_current_appointment(userObj, providerObj, centreObj,
                                              datetimeObj, note, referral_id)
        assert (apmt.patient.full_name == userObj.full_name)
        assert (apmt.provider == providerObj)
        assert (apmt.healthcare_centre == centreObj)
        assert (apmt.datetime == datetimeObj)
        assert (apmt.patient_note == note)
        apmt.patient_note = None
        assert (apmt.patient_note == None)
コード例 #2
0
    def test_booking_same_appointment(self):
        print("test_booking_same_appointment")
        #add a new appointment with same detail from above
        providerObj = system.get_provider("*****@*****.**")
        assert (providerObj.is_provider() == True)

        centreObj = system.get_centre("USYD Health Service")
        assert (centreObj.is_centre() == True)

        userObj = system.get_patient("*****@*****.**")
        assert (userObj.is_provider() == False)

        datetimeObj = datetime.datetime(2018, 1, 1, 10, 30)
        note = "I'm dying, please help me doctor!"
        referral_id = 0

        try:
            apmt = system.add_current_appointment(userObj, providerObj,
                                                  centreObj, datetimeObj, note,
                                                  referral_id)
        except BookingError as be:
            print(be.msg)
            assert (be.msg ==
                    "Booking error occured with fields: double book warning")
            assert (True)
        else:
            assert (False)
        pass
コード例 #3
0
    def test_successful_appointment_with_specialist(self):
        print("test_booking_appointment_with_specialist")
        #add a new appointment with same detail from above
        providerObj = system.get_provider("*****@*****.**")
        assert (providerObj.is_provider() == True)
        assert (providerObj.is_specialist() == True)

        centreObj = system.get_centre("UNSW Health Service")
        assert (centreObj.is_centre() == True)

        userObj = system.get_patient("*****@*****.**")
        assert (userObj.is_provider() == False)

        datetimeObj = datetime.datetime(2018, 1, 1, 10, 30)
        note = "I'm has tumour, please help me doctor!"
        referral_id = 0

        try:
            apmt = system.add_current_appointment(userObj, providerObj,
                                                  centreObj, datetimeObj, note,
                                                  referral_id)
        except BookingError as be:
            assert (False)
        else:
            assert (apmt.patient.full_name == userObj.full_name)
            assert (apmt.provider == providerObj)
            assert (apmt.healthcare_centre == centreObj)
            assert (apmt.datetime == datetimeObj)
            assert (apmt.patient_note == note)
            apmt.patient_note = None
            assert (apmt.patient_note == None)
            pass
コード例 #4
0
    def test_successful_appointment_1(self):
        print("test_successful_booking_appointment_1")

        providerObj = system.get_provider("*****@*****.**")
        assert (providerObj.is_provider() == True)

        centreObj = system.get_centre("Sydney Children Hospital")
        assert (centreObj.is_centre() == True)

        userObj = system.get_patient("*****@*****.**")
        assert (userObj.is_provider() == False)

        datetimeObj = datetime.datetime(2018, 1, 1, 10, 30)
        note = "I'm very sick, please help me doctor!"
        referral_id = 0

        apmt = system.add_current_appointment(userObj, providerObj, centreObj,
                                              datetimeObj, note, referral_id)

        assert (apmt.patient.full_name == userObj.full_name)
        assert (apmt.provider == providerObj)
        assert (apmt.healthcare_centre == centreObj)
        assert (apmt.datetime == datetimeObj)
        assert (apmt.patient_note == note)
        apmt.patient_note = None
        assert (apmt.patient_note == None)
コード例 #5
0
    def test_provider_with_wrong_centre(self):

        print("test_booking_when_centre_not_exist")

        providerObj = system.get_provider("*****@*****.**")
        assert (providerObj.is_provider() == True)

        centreObj = system.get_centre("Prince of Wales Hospital")
        assert (centreObj.is_centre() == True)

        userObj = system.get_patient("*****@*****.**")
        assert (userObj.is_provider() == False)

        datetimeObj = datetime.datetime(2018, 1, 1, 10, 30)
        note = "I'm bleeding, help me!"
        referral_id = 0

        try:
            apmt = system.add_current_appointment(userObj, providerObj,
                                                  centreObj, datetimeObj, note,
                                                  referral_id)
        except BookingError as be:
            print(be.msg)
            #assert(be.msg =="Booking error occured with fields: user")
            assert (True)
        else:
            assert (False)
        pass
        pass
コード例 #6
0
    def test_booking_as_provider(self):

        print("test_booking_as_provider")
        #create a patient to be dummy provider
        providerObj = system.get_patient("*****@*****.**")
        assert (providerObj.is_provider() == False)

        centreObj = system.get_centre("USYD Health Service")
        assert (centreObj.is_centre() == True)

        userObj = system.get_patient("*****@*****.**")
        assert (userObj.is_provider() == False)

        datetimeObj = datetime.datetime(2018, 1, 1, 10, 30)
        note = "I'm drowning, help me!"
        referral_id = 0

        try:
            apmt = system.add_current_appointment(userObj, providerObj,
                                                  centreObj, datetimeObj, note,
                                                  referral_id)
        except BookingError as be:
            print(be.msg)
            #assert(be.msg =="Booking error occured with fields: user")
            assert (True)
        else:
            assert (False)
        pass
コード例 #7
0
 def test_consult_messages(self):
     providerObj = system.get_provider("*****@*****.**")
     centreObj = system.get_centre("Sydney Children Hospital")
     userObj = system.get_patient("*****@*****.**")
     datetimeObj = datetime.datetime(2018, 1, 2, 10, 30)
     note = "I'm very sick, please help me doctor!"
     referral_id = 0
     apmt = system.add_current_appointment(userObj, providerObj, centreObj,
                                           datetimeObj, note, referral_id)
     medication = ""
     comment = ""
     apmt.document_consultation(medication, comment)
     assert apmt.provider_comment == comment
     assert apmt.provider_medication == medication
     medication_1 = "Panadol"
     comment_1 = "Fever"
     apmt.document_consultation(medication, comment)
     assert apmt.provider_comment == comment
     assert apmt.provider_medication == medication
コード例 #8
0
    def test_provider_cannot_book(self):
        print("test_provider_cannot_book")

        providerObj = system.get_provider("*****@*****.**")
        assert (providerObj.is_provider() == True)

        centreObj = system.get_centre("USYD Health Service")
        assert (centreObj.is_centre() == True)

        datetimeObj = datetime.datetime(2018, 1, 1, 10, 30)
        note = "I'm a doctor, please help me too doctor!"
        referral_id = 0

        try:
            apmt = system.add_current_appointment(providerObj, providerObj,
                                                  centreObj, datetimeObj, note,
                                                  referral_id)
        except BookingError as be:
            print(be.msg)
            #assert(be.msg =="Booking error occured with fields: double book warning")
            assert (True)
        else:
            assert (False)
コード例 #9
0
    def test_provider_not_exist(self):
        print("test_booking_when_provider_not_exist")
        centreObj = system.get_centre("USYD Health Service")
        assert (centreObj.is_centre() == True)

        userObj = system.get_provider("*****@*****.**")
        assert (userObj.is_provider() == True)

        datetimeObj = datetime.datetime(2018, 1, 1, 10, 30)
        note = "I'm a doctor, I also get sick!"
        referral_id = 0

        try:
            apmt = system.add_current_appointment(userObj, None, centreObj,
                                                  datetimeObj, note,
                                                  referral_id)
        except BookingError as be:
            print(be.msg)
            #assert(be.msg =="Booking error occured with fields: Unknown provider or specialist, Provider/Centre Relation")
            assert (True)

        else:
            assert (False)
        pass