def test_data_set_create_invalid_parameter(data_set_type, quicksight_application_stub): # stub data_source = DataSource( quicksight_application=quicksight_application_stub, props=None) data_source.arn = "STUBBED_DATA_SOURCE_ARN" quicksight_application_stub.data_source = data_source sub_type = data_set_type obj = DataSet( data_source=data_source, data_set_sub_type=sub_type, props=None, quicksight_application=quicksight_application_stub, ) [ DataSetStubber.stub_create_data_source_error_invalid_parameter_call( sub_type) for _ in range(3) ] response = None with pytest.raises(tenacity.RetryError): # Function under test response = obj.create() assert not response
def test_data_set_create_exist(data_set_type, quicksight_application_stub): # stub data_source = DataSource( quicksight_application=quicksight_application_stub, props=None) data_source.arn = "STUBBED_DATA_SOURCE_ARN" quicksight_application_stub.data_source = data_source sub_type = data_set_type obj = DataSet( data_source=data_source, data_set_sub_type=sub_type, props=None, quicksight_application=quicksight_application_stub, ) DataSetStubber.stub_create_data_set_error_call(sub_type) DataSetStubber.stub_describe_data_set_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 # The describe_data_set reponse does not provide a status at the DataSet level, such # as "Status": "CREATION_SUCCESSFUL" # Therefore, we verify CreatedTime not being None assert response["CreatedTime"] assert obj.arn
def test_data_set_create_all_data_set_types(data_set_type, quicksight_application_stub): data_source = DataSource(quicksight_application=quicksight_application_stub, props=None) # stub data_source.arn = "STUBBED_DATA_SOURCE_ARN" quicksight_application_stub.data_source = data_source data_set = DataSet( data_source=data_source, data_set_sub_type=data_set_type, data_set_name=f"_{data_set_type}_DataSet", props=None, quicksight_application=quicksight_application_stub ) dump_state(data_set, 'Before create') DataSetStubber.stub_create_data_set(data_set_type) data_set.create() dump_state(data_set, 'After create')
def test_data_set_delete_all_data_set_types(data_set_type, quicksight_application_stub): data_source = DataSource(quicksight_application=quicksight_application_stub, props=None) # stub data_source.arn = "STUBBED_DATA_SOURCE_ARN" quicksight_application_stub.data_source = data_source logger.info(f'Initializing dataset object for type: {data_set_type}') data_set = DataSet( data_source=data_source, data_set_sub_type=data_set_type, data_set_name=f"_{data_set_type}_DataSet", props=None, quicksight_application=quicksight_application_stub ) logger.debug(f'After initializing dataset object for type: {data_set_type}') dump_state(data_set, 'Before delete') DataSetStubber.stub_delete_data_set(data_set_type) data_set.delete() dump_state(data_set, 'After delete')