def test_check_goal_status(self): testAssign, testPatient, testProcedure = self.test_create_assignedProcedure( ) result = AssignedProcedures.check_goal_status(testPatient, testProcedure) self.assertEqual(result, "not scheduled") tAssignment = AssignedProcedures.assign_procedure_to_patient( step=2, patientToLink=testPatient, procedureToLink=testProcedure, proc_est=2, return_visit=True) resultz = AssignedProcedures.check_goal_status(testPatient, testProcedure, 2) self.assertEqual(resultz, "in progress (on time)") AssignedProcedures.toggle_completed(testPatient, testProcedure, 2) tAssignment = AssignedProcedures.assign_procedure_to_patient( step=3, patientToLink=testPatient, procedureToLink=testProcedure, proc_est=2, return_visit=True) resultz = AssignedProcedures.check_goal_status(testPatient, testProcedure, 2) self.assertEqual(resultz, "completed (on time)")
def test_toggle_completed(self): testAssign, testPatient, testProcedure = self.test_create_assignedProcedure( ) result = AssignedProcedures.toggle_completed( searchPatient=testPatient, searchProcedure=testProcedure) self.assertTrue(result) result = AssignedProcedures.toggle_completed( searchPatient=testPatient, searchProcedure=testProcedure) self.assertFalse(result)
def test_has_missed_appointment(self): tPatient = Patients.objects.create(first_name="Kyle", last_name="Moo", bday="2000-01-01", referring_physician="Mr magoo", date_of_referral="2019-12-22") tProcedure = Procedure.objects.create(procedure_name="leaches") tProcedure2 = Procedure.objects.create(procedure_name="bloodwork") tAssignedProc = AssignedProcedures.assign_procedure_to_patient(1,tPatient,tProcedure) tAssignedProc.date_scheduled = datetime(2019,3,22) tAssignedProc.scheduled = True AssignedProcedures.toggle_completed(tPatient,tProcedure) tAssignedProc2 = AssignedProcedures.assign_procedure_to_patient(2,tPatient,tProcedure2) tAssignedProc2.date_scheduled = datetime(2019,2,22) tAssignedProc2.scheduled = True AssignedProcedures.toggle_completed(tPatient,tProcedure2) tAssignedProc.save() tAssignedProc2.save() self.assertEqual(True,tPatient.has_missed_appointment())