def test_find_by_learning_container_year_and_linktype(self): a_learning_container_year = LearningContainerYearFactory() expected_container = EntityContainerYearFactory( learning_container_year=a_learning_container_year, type=entity_container_year_link_type.REQUIREMENT_ENTITY) returned_container = entity_container_year.find_by_learning_container_year_and_linktype( a_learning_container_year, entity_container_year_link_type.REQUIREMENT_ENTITY) self.assertEqual(expected_container, returned_container)
def _reinitialize_entities_before_proposal(learning_container_year, initial_entities_by_type): for type_entity, id_entity in initial_entities_by_type.items(): initial_entity = entity.get_by_internal_id(id_entity) if initial_entity: update_or_create_entity_container_year_with_components( initial_entity, learning_container_year, type_entity) else: current_entity_container_year = entity_container_year.find_by_learning_container_year_and_linktype( learning_container_year, type_entity) if current_entity_container_year is not None: current_entity_container_year.delete()