@pytest.mark.skipif((tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS), reason='AutoML is not supported in the region yet.')
def test_auto_ml_attach(sagemaker_session):
    expected_default_input_config = [{'DataSource': {'S3DataSource': {'S3DataType': 'S3Prefix', 'S3Uri': 's3://{}/{}/input/iris_training.csv'.format(sagemaker_session.default_bucket(), PREFIX)}}, 'TargetAttributeName': TARGET_ATTRIBUTE_NAME}]
    expected_default_output_config = {'S3OutputPath': 's3://{}/'.format(sagemaker_session.default_bucket())}
    auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session)
    attached_automl_job = AutoML.attach(auto_ml_job_name=AUTO_ML_JOB_NAME, sagemaker_session=sagemaker_session)
    attached_desc = attached_automl_job.describe_auto_ml_job()
    assert (attached_desc['AutoMLJobName'] == AUTO_ML_JOB_NAME)
    assert (attached_desc['AutoMLJobStatus'] == 'Completed')
    assert isinstance(attached_desc['BestCandidate'], dict)
    assert (attached_desc['InputDataConfig'] == expected_default_input_config)
    assert (attached_desc['AutoMLJobConfig'] == EXPECTED_DEFAULT_JOB_CONFIG)
    assert (attached_desc['OutputDataConfig'] == expected_default_output_config)
@pytest.mark.skipif((tests.integ.test_region() in tests.integ.NO_AUTO_ML_REGIONS), reason='AutoML is not supported in the region yet.')
def test_auto_ml_attach(sagemaker_session):
    expected_default_input_config = [{'DataSource': {'S3DataSource': {'S3DataType': 'S3Prefix', 'S3Uri': 's3://{}/{}/input/iris_training.csv'.format(sagemaker_session.default_bucket(), PREFIX)}}, 'TargetAttributeName': TARGET_ATTRIBUTE_NAME}]
    expected_default_output_config = {'S3OutputPath': 's3://{}/'.format(sagemaker_session.default_bucket())}
    auto_ml_utils.create_auto_ml_job_if_not_exist(sagemaker_session)
    attached_automl_job = AutoML.attach(auto_ml_job_name=AUTO_ML_JOB_NAME, sagemaker_session=sagemaker_session)
    attached_desc = attached_automl_job.describe_auto_ml_job()
    assert (attached_desc['AutoMLJobName'] == AUTO_ML_JOB_NAME)
    assert (attached_desc['AutoMLJobStatus'] == 'Completed')
    assert isinstance(attached_desc['BestCandidate'], dict)
    assert (attached_desc['InputDataConfig'] == expected_default_input_config)
    assert (attached_desc['AutoMLJobConfig'] == EXPECTED_DEFAULT_JOB_CONFIG)
    assert (attached_desc['OutputDataConfig'] == expected_default_output_config)