src/schoology-extractor/data_generation/enrollments.py
def rollback_loaded_enrollments(
    request_client: RequestClient, response_dict: Dict[str, List[Dict]]
):
    """
    Delete already loaded enrollments via the Schoology API.
    **** Used during testing of the load functionality ****

    Parameters
    ----------
    request_client : RequestClient
        A RequestClient initialized for access to the Schoology API
    response_dict: Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like response objects
        from a successful enrollment load operation
    """
    logger.info(
        "**** Rolling back enrollments via Schoology API - for testing purposes"
    )
    for section_id, creation_response in response_dict.items():
        logger.info(
            "**** Deleting %s enrollments for section %s",
            len(creation_response),
            section_id,
        )
        ids: str = ",".join(
            map(lambda enrollment: str(enrollment["id"]), creation_response)
        )

        delete_response = request_client.bulk_delete(
            "enrollments", f"enrollment_ids={ids}"
        )["enrollments"]["enrollment"]

        validate_multi_status(delete_response)
        logger.info("**** Successfully deleted %s enrollments", len(delete_response))

    Delete already loaded enrollments via the Schoology API.
    **** Used during testing of the load functionality ****

    Parameters
    ----------
    request_client : RequestClient
        A RequestClient initialized for access to the Schoology API
    response_dict: Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like response objects
        from a successful enrollment load operation
    
Delete already loaded enrollments via the Schoology API.
Used during testing of the load functionality

Parameters

request_client : RequestClient
A RequestClient initialized for access to the Schoology API
response_dict: Dict[str, List[Dict]]
A Dict of mappings from Schoology section id to a list of JSON-like response objects
from a successful enrollment load operation
Delete already loaded enrollments via the Schoology API . Used during testing of the load functionality Parameters request_client : RequestClient A RequestClient initialized for access to the Schoology API response_dict : Dict [ str List [ Dict ]] A Dict of mappings from Schoology section id to a list of JSON - like response objects from a successful enrollment load operation
def rollback_loaded_enrollments(
    request_client: RequestClient, response_dict: Dict[str, List[Dict]]
):
    logger.info(
        "**** Rolling back enrollments via Schoology API - for testing purposes"
    )
    for section_id, creation_response in response_dict.items():
        logger.info(
            "**** Deleting %s enrollments for section %s",
            len(creation_response),
            section_id,
        )
        ids: str = ",".join(
            map(lambda enrollment: str(enrollment["id"]), creation_response)
        )
        delete_response = request_client.bulk_delete(
            "enrollments", f"enrollment_ids={ids}"
        )["enrollments"]["enrollment"]
        validate_multi_status(delete_response)
        logger.info("**** Successfully deleted %s enrollments", len(delete_response))
def rollback_loaded_enrollments ( request_client : RequestClient , response_dict : Dict [ str , List [ Dict ] ] ) : logger . info ( "**** Rolling back enrollments via Schoology API - for testing purposes" ) for section_id , creation_response in response_dict . items ( ) : logger . info ( "**** Deleting %s enrollments for section %s" , len ( creation_response ) , section_id , ) ids : str = "," . join ( map ( lambda enrollment : str ( enrollment [ "id" ] ) , creation_response ) ) delete_response = request_client . bulk_delete ( "enrollments" , f"enrollment_ids={ids}" ) [ "enrollments" ] [ "enrollment" ] validate_multi_status ( delete_response ) logger . info ( "**** Successfully deleted %s enrollments" , len ( delete_response ) )
Delete already loaded enrollments via the Schoology API.
Delete already loaded enrollments via the Schoology API .
"""
    Delete already loaded enrollments via the Schoology API.
    **** Used during testing of the load functionality ****

    Parameters
    ----------
    request_client : RequestClient
        A RequestClient initialized for access to the Schoology API
    response_dict: Dict[str, List[Dict]]
        A Dict of mappings from Schoology section id to a list of JSON-like response objects
        from a successful enrollment load operation
    """
request_client
RequestClient
response_dict
Dict[str, List[Dict]]