def test_astore_model(session, cas_session, change_dir):
    """Ensure the register_sas_classification_model.py example executes successfully."""

    # Mock up Session() to return the Betamax-recorded session
    def Session(*args, **kwargs):
        return session

    change_dir('examples')
    with open('register_sas_classification_model.py') as f:
        # Remove Session import and set CAS session to Betamax-recorded CAS
        # session
        code = f.read().replace('from sasctl import Session', '')
        code = code.replace(
            "s = swat.CAS('hostname', 5570, 'username', 'password')", 's = cas_session'
        )
        # Exec the script.
        exec(code)