def test_get_first_incomplete_phase(self): testAssign, testPatient, testProcedure = self.test_create_assignedProcedure( ) testProcedure2 = Procedure.objects.create(procedure_name="Procedure 2") testProcedure3 = Procedure.objects.create(procedure_name="Procedure 3") assigned2 = AssignedProcedures.assign_procedure_to_patient( 2, testPatient, testProcedure2) assigned3 = AssignedProcedures.assign_procedure_to_patient( 3, testPatient, testProcedure3) first_incomplete_phase = AssignedProcedures.get_first_incomplete_phase( testPatient) self.assertEqual(first_incomplete_phase, 1) AssignedProcedures.set_complete(testPatient, testProcedure, 1) first_incomplete_phase = AssignedProcedures.get_first_incomplete_phase( testPatient) self.assertEqual(first_incomplete_phase, 2) AssignedProcedures.set_complete(testPatient, testProcedure2, 2) first_incomplete_phase = AssignedProcedures.get_first_incomplete_phase( testPatient) self.assertEqual(first_incomplete_phase, 3)
def test_set_complete(self): testAssign, testPatient, testProcedure = self.test_create_assignedProcedure( ) self.assertFalse(testAssign.completed) AssignedProcedures.set_complete(testPatient, testProcedure, testAssign.phaseNumber) resultAssign = AssignedProcedures.objects.get( patient=testPatient, procedure=testProcedure, phaseNumber=testAssign.phaseNumber) self.assertTrue(resultAssign.completed) return resultAssign, testPatient, testProcedure