def copy_snapshot_test_plan(objects): """Append snapshot test plan into assessment test plan""" for obj in objects: if (obj.source_type == "Assessment" and obj.destination_type == "Snapshot") or (obj.source_type == "Snapshot" and obj.destination_type == "Assessment"): asmnt, snapshot = obj.source, obj.destination if asmnt.type != "Assessment": asmnt, snapshot = snapshot, asmnt # Test plan of snapshotted object should be copied to # Assessment test plan in case of proper snapshot type # and if test_plan_procedure was set to True if asmnt.assessment_type == snapshot.child_type and \ asmnt.test_plan_procedure: assessment.copy_snapshot_plan(asmnt, snapshot)
def copy_snapshot_test_plan(objects, sources): """Append snapshot test plan into assessment test plan""" for obj, src in zip(objects, sources): if (obj.source_type == "Assessment" and obj.destination_type == "Snapshot") or (obj.source_type == "Snapshot" and obj.destination_type == "Assessment"): asmnt, snapshot = obj.source, obj.destination if asmnt.type != "Assessment": asmnt, snapshot = snapshot, asmnt # Test plan of snapshotted object should be copied to # Assessment test plan in case of proper snapshot type # and if copyAssessmentProcedure flag was sent, it should # be set to True if asmnt.assessment_type == snapshot.child_type and \ src.get("copyAssessmentProcedure", True): assessment.copy_snapshot_plan(asmnt, snapshot)
def copy_snapshot_test_plan(objects): """Append snapshot test plan into assessment test plan""" for obj in objects: if (obj.source_type == "Assessment" and obj.destination_type == "Snapshot") or ( obj.source_type == "Snapshot" and obj.destination_type == "Assessment" ): asmnt, snapshot = obj.source, obj.destination if asmnt.type != "Assessment": asmnt, snapshot = snapshot, asmnt # Test plan of snapshotted object should be copied to # Assessment test plan in case of proper snapshot type # and if test_plan_procedure was set to True if asmnt.assessment_type == snapshot.child_type and \ asmnt.test_plan_procedure: assessment.copy_snapshot_plan(asmnt, snapshot)
def test_missing_snapshot_plan(self): """Test copy_snapshot_plan when test_plan is missing from revision""" self.snapshot.revision.content = {} assessment_test_plan = self.assessment.test_plan assessment.copy_snapshot_plan(self.assessment, self.snapshot) self.assertEqual(assessment_test_plan, self.assessment.test_plan)