예제 #1
0
    def testGetAllENTSurgicalHistories(self):
        x = CreateClinic(host, port, token, "Ensenada", "02/05/2016",
                         "02/06/2016")
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        self.assertTrue("id" in ret[1])
        clinicid1 = int(ret[1]["id"])

        x = CreateClinic(host, port, token, "Ensenada", "05/05/2016",
                         "05/06/2016")
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        self.assertTrue("id" in ret[1])
        clinicid2 = int(ret[1]["id"])

        x = CreateClinic(host, port, token, "Ensenada", "08/05/2016",
                         "08/06/2016")
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        self.assertTrue("id" in ret[1])
        clinicid3 = int(ret[1]["id"])

        data = {}
        data["paternal_last"] = "3abcd1234"
        data["maternal_last"] = "yyyyyy"
        data["first"] = "zzzzzzz"
        data["middle"] = ""
        data["suffix"] = "Jr."
        data["prefix"] = ""
        data["dob"] = "04/01/1962"
        data["gender"] = "Female"
        data["street1"] = "1234 First Ave"
        data["street2"] = ""
        data["city"] = "Ensenada"
        data["colonia"] = ""
        data["state"] = u"Baja California"
        data["phone1"] = "1-111-111-1111"
        data["phone2"] = ""
        data["email"] = "*****@*****.**"
        data["emergencyfullname"] = "Maria Sanchez"
        data["emergencyphone"] = "1-222-222-2222"
        data["emergencyemail"] = "*****@*****.**"

        x = CreatePatient(host, port, token, data)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        patientid1 = int(ret[1]["id"])

        data = {}
        data["paternal_last"] = "1abcd1234"
        data["maternal_last"] = "yyyyyy"
        data["first"] = "zzzzzzz"
        data["middle"] = ""
        data["suffix"] = "Jr."
        data["prefix"] = ""
        data["dob"] = "04/01/1962"
        data["gender"] = "Female"
        data["street1"] = "1234 First Ave"
        data["street2"] = ""
        data["city"] = "Ensenada"
        data["colonia"] = ""
        data["state"] = u"Baja California"
        data["phone1"] = "1-111-111-1111"
        data["phone2"] = ""
        data["email"] = "*****@*****.**"
        data["emergencyfullname"] = "Maria Sanchez"
        data["emergencyphone"] = "1-222-222-2222"
        data["emergencyemail"] = "*****@*****.**"

        x = CreatePatient(host, port, token, data)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        patientid2 = int(ret[1]["id"])

        data = {}
        data["paternal_last"] = "2abcd1234"
        data["maternal_last"] = "yyyyyy"
        data["first"] = "zzzzzzz"
        data["middle"] = ""
        data["suffix"] = "Jr."
        data["prefix"] = ""
        data["dob"] = "04/01/1962"
        data["gender"] = "Female"
        data["street1"] = "1234 First Ave"
        data["street2"] = ""
        data["city"] = "Ensenada"
        data["colonia"] = ""
        data["state"] = u"Baja California"
        data["phone1"] = "1-111-111-1111"
        data["phone2"] = ""
        data["email"] = "*****@*****.**"
        data["emergencyfullname"] = "Maria Sanchez"
        data["emergencyphone"] = "1-222-222-2222"
        data["emergencyemail"] = "*****@*****.**"

        x = CreatePatient(host, port, token, data)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        patientid3 = int(ret[1]["id"])

        delids = []

        x = CreateENTSurgicalHistory(host, port, token)
        x.setPatient(patientid1)
        x.setClinic(clinicid1)
        x.setUsername("Gomez")
        x.setGranuloma("left")
        x.setGranulomaComment("granuloma")
        x.setTubes("left")
        x.setTubesComment("tubes")
        x.setTplasty("right")
        x.setTplastyComment("tplasty")
        x.setEua("both")
        x.setEuaComment("eua")
        x.setFb("none")
        x.setFbComment("fb")
        x.setMyringotomy("left")
        x.setMyringotomyComment("myring")
        x.setCerumen("right")
        x.setCerumenComment("cerumen")
        x.setSeptorhinoplasty(True)
        x.setSeptorhinoplastyComment("septo")
        x.setScarrevision(False)
        x.setScarrevisionComment("scar")
        x.setFrenulectomy(True)
        x.setFrenulectomyComment("fren")

        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        delids.append(ret[1]["id"])

        x = CreateENTSurgicalHistory(host, port, token)
        x.setPatient(patientid2)
        x.setClinic(clinicid1)
        x.setUsername("Gomez")
        x.setGranuloma("left")
        x.setGranulomaComment("granuloma")
        x.setTubes("left")
        x.setTubesComment("tubes")
        x.setTplasty("right")
        x.setTplastyComment("tplasty")
        x.setEua("both")
        x.setEuaComment("eua")
        x.setFb("none")
        x.setFbComment("fb")
        x.setMyringotomy("left")
        x.setMyringotomyComment("myring")
        x.setCerumen("right")
        x.setCerumenComment("cerumen")
        x.setSeptorhinoplasty(True)
        x.setSeptorhinoplastyComment("septo")
        x.setScarrevision(False)
        x.setScarrevisionComment("scar")
        x.setFrenulectomy(True)
        x.setFrenulectomyComment("fren")

        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        delids.append(ret[1]["id"])

        x = CreateENTSurgicalHistory(host, port, token)
        x.setPatient(patientid3)
        x.setClinic(clinicid1)
        x.setUsername("Gomez")
        x.setGranuloma("left")
        x.setGranulomaComment("granuloma")
        x.setTubes("left")
        x.setTubesComment("tubes")
        x.setTplasty("right")
        x.setTplastyComment("tplasty")
        x.setEua("both")
        x.setEuaComment("eua")
        x.setFb("none")
        x.setFbComment("fb")
        x.setMyringotomy("left")
        x.setMyringotomyComment("myring")
        x.setCerumen("right")
        x.setCerumenComment("cerumen")
        x.setSeptorhinoplasty(True)
        x.setSeptorhinoplastyComment("septo")
        x.setScarrevision(False)
        x.setScarrevisionComment("scar")
        x.setFrenulectomy(True)
        x.setFrenulectomyComment("fren")

        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        delids.append(ret[1]["id"])

        x = CreateENTSurgicalHistory(host, port, token)
        x.setPatient(patientid1)
        x.setClinic(clinicid2)
        x.setUsername("Gomez")
        x.setGranuloma("left")
        x.setGranulomaComment("granuloma")
        x.setTubes("left")
        x.setTubesComment("tubes")
        x.setTplasty("right")
        x.setTplastyComment("tplasty")
        x.setEua("both")
        x.setEuaComment("eua")
        x.setFb("none")
        x.setFbComment("fb")
        x.setMyringotomy("left")
        x.setMyringotomyComment("myring")
        x.setCerumen("right")
        x.setCerumenComment("cerumen")
        x.setSeptorhinoplasty(True)
        x.setSeptorhinoplastyComment("septo")
        x.setScarrevision(False)
        x.setScarrevisionComment("scar")
        x.setFrenulectomy(True)
        x.setFrenulectomyComment("fren")

        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        delids.append(ret[1]["id"])

        x = CreateENTSurgicalHistory(host, port, token)
        x.setPatient(patientid2)
        x.setClinic(clinicid2)
        x.setUsername("Gomez")
        x.setGranuloma("left")
        x.setGranulomaComment("granuloma")
        x.setTubes("left")
        x.setTubesComment("tubes")
        x.setTplasty("right")
        x.setTplastyComment("tplasty")
        x.setEua("both")
        x.setEuaComment("eua")
        x.setFb("none")
        x.setFbComment("fb")
        x.setMyringotomy("left")
        x.setMyringotomyComment("myring")
        x.setCerumen("right")
        x.setCerumenComment("cerumen")
        x.setSeptorhinoplasty(True)
        x.setSeptorhinoplastyComment("septo")
        x.setScarrevision(False)
        x.setScarrevisionComment("scar")
        x.setFrenulectomy(True)
        x.setFrenulectomyComment("fren")

        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        delids.append(ret[1]["id"])

        x = CreateENTSurgicalHistory(host, port, token)
        x.setPatient(patientid3)
        x.setClinic(clinicid2)
        x.setUsername("Gomez")
        x.setGranuloma("left")
        x.setGranulomaComment("granuloma")
        x.setTubes("left")
        x.setTubesComment("tubes")
        x.setTplasty("right")
        x.setTplastyComment("tplasty")
        x.setEua("both")
        x.setEuaComment("eua")
        x.setFb("none")
        x.setFbComment("fb")
        x.setMyringotomy("left")
        x.setMyringotomyComment("myring")
        x.setCerumen("right")
        x.setCerumenComment("cerumen")
        x.setSeptorhinoplasty(True)
        x.setSeptorhinoplastyComment("septo")
        x.setScarrevision(False)
        x.setScarrevisionComment("scar")
        x.setFrenulectomy(True)
        x.setFrenulectomyComment("fren")

        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        delids.append(ret[1]["id"])

        x = CreateENTSurgicalHistory(host, port, token)
        x.setPatient(patientid1)
        x.setClinic(clinicid3)
        x.setUsername("Gomez")
        x.setGranuloma("left")
        x.setGranulomaComment("granuloma")
        x.setTubes("left")
        x.setTubesComment("tubes")
        x.setTplasty("right")
        x.setTplastyComment("tplasty")
        x.setEua("both")
        x.setEuaComment("eua")
        x.setFb("none")
        x.setFbComment("fb")
        x.setMyringotomy("left")
        x.setMyringotomyComment("myring")
        x.setCerumen("right")
        x.setCerumenComment("cerumen")
        x.setSeptorhinoplasty(True)
        x.setSeptorhinoplastyComment("septo")
        x.setScarrevision(False)
        x.setScarrevisionComment("scar")
        x.setFrenulectomy(True)
        x.setFrenulectomyComment("fren")

        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        delids.append(ret[1]["id"])

        x = CreateENTSurgicalHistory(host, port, token)
        x.setPatient(patientid2)
        x.setClinic(clinicid3)
        x.setUsername("Gomez")
        x.setGranuloma("left")
        x.setGranulomaComment("granuloma")
        x.setTubes("left")
        x.setTubesComment("tubes")
        x.setTplasty("right")
        x.setTplastyComment("tplasty")
        x.setEua("both")
        x.setEuaComment("eua")
        x.setFb("none")
        x.setFbComment("fb")
        x.setMyringotomy("left")
        x.setMyringotomyComment("myring")
        x.setCerumen("right")
        x.setCerumenComment("cerumen")
        x.setSeptorhinoplasty(True)
        x.setSeptorhinoplastyComment("septo")
        x.setScarrevision(False)
        x.setScarrevisionComment("scar")
        x.setFrenulectomy(True)
        x.setFrenulectomyComment("fren")

        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        delids.append(ret[1]["id"])

        x = CreateENTSurgicalHistory(host, port, token)
        x.setPatient(patientid3)
        x.setClinic(clinicid3)
        x.setUsername("Gomez")
        x.setGranuloma("left")
        x.setGranulomaComment("granuloma")
        x.setTubes("left")
        x.setTubesComment("tubes")
        x.setTplasty("right")
        x.setTplastyComment("tplasty")
        x.setEua("both")
        x.setEuaComment("eua")
        x.setFb("none")
        x.setFbComment("fb")
        x.setMyringotomy("left")
        x.setMyringotomyComment("myring")
        x.setCerumen("right")
        x.setCerumenComment("cerumen")
        x.setSeptorhinoplasty(True)
        x.setSeptorhinoplastyComment("septo")
        x.setScarrevision(False)
        x.setScarrevisionComment("scar")
        x.setFrenulectomy(True)
        x.setFrenulectomyComment("fren")

        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        delids.append(ret[1]["id"])

        x = GetENTSurgicalHistory(host, port, token)
        x.setClinic(clinicid1)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        rtcs = ret[1]
        self.assertTrue(len(rtcs) == 3)

        x = GetENTSurgicalHistory(host, port, token)
        x.setClinic(clinicid2)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        rtcs = ret[1]
        self.assertTrue(len(rtcs) == 3)

        x = GetENTSurgicalHistory(host, port, token)
        x.setClinic(clinicid3)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        rtcs = ret[1]
        self.assertTrue(len(rtcs) == 3)

        x = GetENTSurgicalHistory(host, port, token)
        x.setPatient(patientid1)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        rtcs = ret[1]
        self.assertTrue(len(rtcs) == 3)

        x = GetENTSurgicalHistory(host, port, token)
        x.setPatient(patientid2)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        rtcs = ret[1]
        self.assertTrue(len(rtcs) == 3)

        x = GetENTSurgicalHistory(host, port, token)
        x.setPatient(patientid3)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        rtcs = ret[1]
        self.assertTrue(len(rtcs) == 3)

        for x in delids:
            y = DeleteENTSurgicalHistory(host, port, token, x)
            ret = y.send(timeout=30)
            self.assertEqual(ret[0], 200)

        x = GetENTSurgicalHistory(host, port, token)
        x.setClinic(clinicid1)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 404)
        rtcs = ret[1]
        self.assertTrue(len(rtcs) == 0)

        x = DeleteClinic(host, port, token, clinicid1)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)

        x = DeleteClinic(host, port, token, clinicid2)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)

        x = DeleteClinic(host, port, token, clinicid3)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)

        x = DeletePatient(host, port, token, patientid1)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)

        x = DeletePatient(host, port, token, patientid2)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)

        x = DeletePatient(host, port, token, patientid3)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
예제 #2
0
    def testUpdateENTSurgicalHistory(self):
        x = CreateClinic(host, port, token, "Ensenada", "02/05/2016",
                         "02/06/2016")
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        self.assertTrue("id" in ret[1])
        clinicid = int(ret[1]["id"])

        data = {}

        data["paternal_last"] = "abcd1234"
        data["maternal_last"] = "yyyyyy"
        data["first"] = "zzzzzzz"
        data["middle"] = ""
        data["suffix"] = "Jr."
        data["prefix"] = ""
        data["dob"] = "04/01/1962"
        data["gender"] = "Female"
        data["street1"] = "1234 First Ave"
        data["street2"] = ""
        data["city"] = "Ensenada"
        data["colonia"] = ""
        data["state"] = u"Baja California"
        data["phone1"] = "1-111-111-1111"
        data["phone2"] = ""
        data["email"] = "*****@*****.**"
        data["emergencyfullname"] = "Maria Sanchez"
        data["emergencyphone"] = "1-222-222-2222"
        data["emergencyemail"] = "*****@*****.**"

        x = CreatePatient(host, port, token, data)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        patientid = int(ret[1]["id"])

        x = CreateENTSurgicalHistory(host, port, token)
        x.setPatient(patientid)
        x.setClinic(clinicid)
        x.setUsername("Gomez")

        x.setGranuloma("left")
        x.setGranulomaComment("granuloma")
        x.setTubes("left")
        x.setTubesComment("tubes")
        x.setTplasty("right")
        x.setTplastyComment("tplasty")
        x.setEua("both")
        x.setEuaComment("eua")
        x.setFb("none")
        x.setFbComment("fb")
        x.setMyringotomy("left")
        x.setMyringotomyComment("myring")
        x.setCerumen("right")
        x.setCerumenComment("cerumen")
        x.setSeptorhinoplasty(True)
        x.setSeptorhinoplastyComment("septo")
        x.setScarrevision(False)
        x.setScarrevisionComment("scar")
        x.setFrenulectomy(True)
        x.setFrenulectomyComment("fren")

        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        id = int(ret[1]["id"])

        x = GetENTSurgicalHistory(host, port, token)
        x.setId(id)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        self.assertTrue("clinic" in ret[1])
        clinicId = int(ret[1]["clinic"])
        self.assertTrue(clinicId == clinicid)
        self.assertTrue("patient" in ret[1])
        patientId = int(ret[1]["patient"])
        self.assertTrue(patientId == patientid)

        x = UpdateENTSurgicalHistory(host, port, token, id)
        x.setFb("both")
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)

        x = GetENTSurgicalHistory(host, port, token)
        x.setId(id)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        self.assertTrue("clinic" in ret[1])
        clinicId = int(ret[1]["clinic"])
        self.assertTrue(clinicId == clinicid)
        self.assertTrue("patient" in ret[1])
        patientId = int(ret[1]["patient"])
        self.assertTrue(patientId == patientid)
        self.assertTrue(ret[1]["fb"] == "both")

        x = UpdateENTSurgicalHistory(host, port, token, id)
        x.setFrenulectomy(False)
        x.setTubes("right")
        x.setEua("both")
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)

        x = UpdateENTSurgicalHistory(host, port, token, id)
        x.setClinic(clinicid)
        x.setPatient(patientid)
        x.setMyringotomy("zzz")
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 400)

        x = UpdateENTSurgicalHistory(host, port, token, id)
        x.setClinic(clinicid)
        x.setPatient(patientid)
        x.setTubes(True)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 400)

        x = UpdateENTSurgicalHistory(host, port, token, id)
        x.setClinic(clinicid)
        x.setPatient(patientid)
        x.setCerumenComment(14)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 400)

        x = UpdateENTSurgicalHistory(host, port, token, id)
        x.setClinic(clinicid)
        x.setPatient(patientid)
        x.setFrenulectomy("none")
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 400)

        x = UpdateENTSurgicalHistory(host, port, token, id)
        x.setClinic(clinicid)
        x.setPatient(patientid)
        x.setTplasty("both")
        x.setTubesComment(513)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 400)

        x = UpdateENTSurgicalHistory(host, port, token, id)
        x.setClinic(clinicid)
        x.setPatient(patientid)
        x.setScarrevision(True)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)

        x = GetENTSurgicalHistory(host, port, token)
        x.setId(id)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        self.assertTrue("clinic" in ret[1])
        clinicId = int(ret[1]["clinic"])
        self.assertTrue(clinicId == clinicid)
        self.assertTrue("patient" in ret[1])
        patientId = int(ret[1]["patient"])
        self.assertTrue(patientId == patientid)
        self.assertTrue(ret[1]["fb"] == "both")
        self.assertTrue(ret[1]["frenulectomy"] == False)
        self.assertTrue(ret[1]["tubes"] == "right")
        self.assertTrue(ret[1]["eua"] == "both")
        self.assertTrue(ret[1]["scarrevision"] == True)

        x = UpdateENTSurgicalHistory(host, port, token, id)
        x.setTplastyComment("a tplasty comment")
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)

        x = UpdateENTSurgicalHistory(host, port, token, id)
        x.setCerumen("none")
        x.setFb("left")
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)

        x = GetENTSurgicalHistory(host, port, token)
        x.setId(id)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)
        self.assertTrue("clinic" in ret[1])
        clinicId = int(ret[1]["clinic"])
        self.assertTrue(clinicId == clinicid)
        self.assertTrue("patient" in ret[1])
        patientId = int(ret[1]["patient"])
        self.assertTrue(patientId == patientid)
        self.assertTrue(ret[1]["fb"] == "left")
        self.assertTrue(ret[1]["frenulectomy"] == False)
        self.assertTrue(ret[1]["tubes"] == "right")
        self.assertTrue(ret[1]["eua"] == "both")
        self.assertTrue(ret[1]["cerumen"] == "none")
        self.assertTrue(ret[1]["scarrevision"] == True)
        self.assertTrue(ret[1]["tplastycomment"] == "a tplasty comment")

        x = DeleteENTSurgicalHistory(host, port, token, id)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)

        x = DeleteClinic(host, port, token, clinicid)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)

        x = DeletePatient(host, port, token, patientid)
        ret = x.send(timeout=30)
        self.assertEqual(ret[0], 200)