def test_data_source_create(quicksight_application_stub):
    obj = DataSource(
        quicksight_application=quicksight_application_stub,
        props=None
    )

    dump_state(obj)

    sub_type = 'main'
    dump_state(obj, 'Before create')
    DataSourceStubber.stub_create_data_source_call(sub_type)
    obj.create()
    dump_state(obj, 'After create')
def test_data_source_create(quicksight_application_stub):
    obj = DataSource(quicksight_application=quicksight_application_stub,
                     props=None)

    assert obj.athena_workgroup
    assert obj.athena_workgroup == "primary"
    dump_state(obj)

    sub_type = 'main'
    dump_state(obj, 'Before create')
    DataSourceStubber.stub_create_data_source_call(sub_type)
    response = obj.create()
    assert response
    assert response["Status"] in [202]
    assert response["CreationStatus"] in ["CREATION_IN_PROGRESS"]
    assert obj.arn
    dump_state(obj, 'After create')
def test_data_source_create_exist(quicksight_application_stub):
    obj = DataSource(quicksight_application=quicksight_application_stub,
                     props=None)

    assert obj.athena_workgroup
    assert obj.athena_workgroup == "primary"

    sub_type = "main"
    DataSourceStubber.stub_create_data_source_error_call(sub_type)
    DataSourceStubber.stub_describe_data_source_call(sub_type)

    # Function under test
    response = obj.create()

    # This response is the response to describe_data_source as the code is remaps the response
    assert response
    assert response["Status"] in ["CREATION_SUCCESSFUL"]
    assert obj.arn