Features
This section describes all features that are shipped with this package.
Scenario Features
SINGLE Retrieve Features
- class balderhub.crud.lib.scenario_features.SingleReadExampleProvider(**kwargs)
Bases:
BaseSingleExampleProviderProvides example selection of existing data items that should be read.
- get_valid_examples() list[balderhub.crud.lib.scenario_features.base_single_example_provider.BaseSingleExampleProvider.NamedExample]
- Returns:
returns a list of valid examples
- class balderhub.crud.lib.scenario_features.SingleReaderFeature(**kwargs)
Bases:
BaseCollectorFeatureScenario Feature that reads one data items from the system-under-test.
- collect() SingleDataItem
Executes the collecting process of the data item. :return: the collected data item
- load(unique_identification_value: Any)
Loads the system-under-test to be in the state for collecting the data item.
MULTIPLE Retrieve Features
- class balderhub.crud.lib.scenario_features.MultipleReaderFeature(**kwargs)
Bases:
BaseCollectorFeatureScenario Feature that reads a list of data items from the system-under-test.
- collect() SingleDataItemCollection
Executes the collecting process of the data items. :return: the collected data items
- load() None
Loads the system-under-test to be in the state for collecting the data items.
MULTIPLE Create Features
Note
The MULTIPLE CREATION is not fully supported yet.
SINGLE Create Features
- class balderhub.crud.lib.scenario_features.SingleCreatorFeature(**kwargs)
Bases:
SingleFillerFeatureScenario Feature that creates a new data item in the system-under-test.
- get_expected_default_values_for_fields() dict[str, Any]
- Returns:
returns a dictionary of expected default values for fields in the system-under-test.
- load(**kwargs) None
Loads the system-under-test to be in the state for filling the data item.
- property resolved_fields_with_default_values: list[str]
- Returns:
a full resolved list of fields that have default values (means: if there is no value given with this creator feature, it expects that the default value (specified within
SingleDataCreatorFeature.get_expected_default_values_for_fields()) is set
- property resolved_mandatory_fields: list[str]
- Returns:
a full resolved list of fields that needs to be provided (means: if there is no value given with this creator feature, it expects that there will be an error)
- class balderhub.crud.lib.scenario_features.SingleCreateExampleProvider(**kwargs)
Bases:
BaseSingleExampleProviderThis feature provides full example data for a specific single data item.
- get_invalid_examples() list[balderhub.crud.lib.scenario_features.base_single_example_provider.BaseSingleExampleProvider.NamedExample]
- Returns:
returns a list of invalid examples
MULTIPLE Update Features
Note
The MULTIPLE UPDATE is not fully supported yet.
SINGLE Update Features
- class balderhub.crud.lib.scenario_features.SingleUpdaterFeature(**kwargs)
Bases:
SingleFillerFeatureScenario Feature that updating a new data item in the system-under-test.
- load(unique_identification_value: Any, **kwargs)
Loads the system-under-test to be in the state for filling the data item.
- class balderhub.crud.lib.scenario_features.SingleUpdateFieldExampleProvider(**kwargs)
Bases:
BaseFieldExampleProviderThis feature provides example data for specific fields of a data item.
- class NamedExample(name: str, data_item: ~balderhub.data.lib.utils.single_data_item.SingleDataItem, field_name: str, new_field_value: ~typing.Any, expected_response_messages: ~balderhub.data.lib.utils.response_message_list.ResponseMessageList = <factory>)
Bases:
NamedExampleinternal data class that describes an example
- get_invalid_new_value_for_field(field: str) list[balderhub.crud.lib.scenario_features.single_update_field_example_provider.SingleUpdateFieldExampleProvider.NamedExample]
This method returns invalid example data for a specific field of an existing data item instance. This will be called for change requests of a specific field of an existing data item. It will be expected, that it is not possible to set the provided value in the app-under-test.
- Parameters:
field – the field name that should be changed
- Returns:
the new value for the field
- get_valid_new_value_for_field(field: str) list[balderhub.crud.lib.scenario_features.single_update_field_example_provider.SingleUpdateFieldExampleProvider.NamedExample]
This method returns valid example data for a specific field of an existing data item instance. This will be called for change requests of a specific field of an existing data item.
- Parameters:
field – the field name that should be changed
- Returns:
the new value for the field
MULTIPLE Delete Features
Note
The MULTIPLE DELETION is not fully supported yet.
SINGLE Delete Features
Note
The DELETION is not fully supported yet.
- class balderhub.crud.lib.scenario_features.SingleDeleterFeature(**kwargs)
Bases:
BaseInteractorFeatureScenario Feature that deletes an existing data item in the system-under-test.
- delete() None
Executes the deleting of the data item.
- load()
Loads the system-under-test to be in the state for deleting the data item.
- class balderhub.crud.lib.scenario_features.SingleDeleteExampleProvider(**kwargs)
Bases:
BaseSingleExampleProviderProvides example selection of existing data items that should be deleted.
- get_valid_examples() list[balderhub.crud.lib.scenario_features.base_single_example_provider.BaseSingleExampleProvider.NamedExample]
- Returns:
returns a list of valid examples
Base Feature Classes
- class balderhub.crud.lib.scenario_features.BaseCollectorFeature(**kwargs)
Bases:
BaseInteractorFeatureScenario Feature that reads field data of data items.
- get_active_error_messages() ResponseMessageList
- Returns:
returns a list of all active error messages
- get_active_success_messages() ResponseMessageList
- Returns:
returns a list of all active success messages
- get_non_collectable_fields() list[str]
This method should return a list of field names that are not collectable by this feature. Note that the method will assign the
NOT_DEFINABLEobject to them.You can provide lookup strings for this field too. If the field is a nested data item, the feature will automatically resolve the nested fields.
- Returns:
returns a list of fields that are not collectable with this feature
- is_non_collectable_field(field_lookup: str) bool
Checks if the provided field lookup string is a non-collectable field :param field_lookup: the field lookup to check :return: True if it is non-collectable, False otherwise
- property resolved_collectable_fields: list[str]
- Returns:
a full resolved list of fields that are collectable with this feature
- property resolved_non_collectable_fields: list[str]
- Returns:
a full resolved list of fields that are not collectable with this feature
- class balderhub.crud.lib.scenario_features.BaseExampleProvider(**kwargs)
Bases:
AbstractDataItemRelatedFeatureThis config feature provides information for a single data item element of its specific data item type.
- class NamedExample(name: str)
Bases:
objectinternal data class that describes an example
- get_first_valid_example() NamedExample
This method returns the first valid example of the provided examples within get_valid_examples. :return: the first valid example defined within get_valid_examples()
- get_valid_examples() list[balderhub.crud.lib.scenario_features.base_example_provider.BaseExampleProvider.NamedExample]
- Returns:
returns a list of valid examples
- class balderhub.crud.lib.scenario_features.BaseFieldExampleProvider(**kwargs)
Bases:
AbstractDataItemRelatedFeatureThis config feature provides information for fields of data item elements of its specific data item type.
- class NamedExample(name: str)
Bases:
objectinternal data class that describes an example
- get_invalid_new_value_for_field(field: str) list[balderhub.crud.lib.scenario_features.base_field_example_provider.BaseFieldExampleProvider.NamedExample]
This method returns invalid example data for a specific field of an existing data item instance. This will be called for change requests of a specific field of an existing data item. It will be expected, that it is not possible to set the provided value in the app-under-test.
- Parameters:
field – the field name that should be changed
- Returns:
the new value for the field
- get_valid_new_value_for_field(field: str) list[balderhub.crud.lib.scenario_features.base_field_example_provider.BaseFieldExampleProvider.NamedExample]
This method returns valid example data for a specific field of an existing data item instance. This will be called for change requests of a specific field of an existing data item.
- Parameters:
field – the field name that should be changed
- Returns:
the new value for the field
- class balderhub.crud.lib.scenario_features.BaseInteractorFeature(**kwargs)
Bases:
AbstractDataItemRelatedFeatureFeature class that interacts with the system-under-test in some kind.
- get_active_error_messages() ResponseMessageList
- Returns:
returns a list of all active error messages
- get_active_success_messages() ResponseMessageList
- Returns:
returns a list of all active success messages
- class balderhub.crud.lib.scenario_features.BaseSingleExampleProvider(**kwargs)
Bases:
BaseExampleProviderBase class for example provider features that returns a single element
- class NamedExample(name: str, data_item: ~balderhub.data.lib.utils.single_data_item.SingleDataItem, expected_response_messages: ~balderhub.data.lib.utils.response_message_list.ResponseMessageList = <factory>)
Bases:
NamedExamplehelper dataclass to describe a single named example
- get_valid_examples() list[balderhub.crud.lib.scenario_features.base_single_example_provider.BaseSingleExampleProvider.NamedExample]
- Returns:
returns a list of valid examples
Scenario Factories
- class balderhub.crud.lib.scenario_features.factories.AutoSingleReadExampleFactory
Bases:
AutoFeatureFactoryFactory for creating data-item bounded scenario-based config-feature
SingleReadExampleProvider
Setup Features
- class balderhub.crud.lib.setup_features.MultipleReaderFeature(**kwargs)
Bases:
MultipleReaderFeatureSetup multiple-reader feature with field callback mapping
- collect() SingleDataItemCollection
Executes the collecting process of the data items. :return: the collected data items
- get_list_item_element_container() list[ElementListItemContainerTypeT]
this callback collects the data of the table and returns a dictionary with the unique id as key and the data as value
- item_mapping() dict[str, balderhub.crud.lib.utils.field_callbacks.field_collector_callback.FieldCollectorCallback]
returns a dictionary with the dataclass field name as key and the callback that returns the data for this field as value - the value is a tuple with the callback on the first place and the parameter afterwards
- load()
Loads the system-under-test to be in the state for collecting the data items.
- class balderhub.crud.lib.setup_features.SingleCreatorFeature(**kwargs)
Bases:
SingleCreatorFeatureSetup creating feature with field callback mapping
- fill(data_class_dict: dict[str, Any]) dict[str, Any]
This method fills all the data of the provided data class :param data_class_dict: the values that should be filled in as a dictionary :return: a new data class with the data, that was filled in
- get_element_container() ElementContainerTypeT
This method returns a custom object that will be given to any callback. :return:
- item_mapping() dict[str, balderhub.crud.lib.utils.field_callbacks.field_filler_callback.FieldFillerCallback]
returns a dictionary with the dataclass field name as key and its configuration as value
- class balderhub.crud.lib.setup_features.SingleReaderFeature(**kwargs)
Bases:
SingleReaderFeatureSetup single-read feature with field callback mapping
- collect() SingleDataItem
Executes the collecting process of the data item. :return: the collected data item
- get_element_container() ElementContainerTypeT
This method returns a custom object that will be given to any callback. :return:
- item_mapping() dict[str, balderhub.crud.lib.utils.field_callbacks.field_collector_callback.FieldCollectorCallback]
returns a dictionary with the dataclass field name as key and the callback that returns the data for this field as value - the value is a tuple with the callback on the first place and the parameter afterwards
- class balderhub.crud.lib.setup_features.SingleUpdaterFeature(**kwargs)
Bases:
SingleUpdaterFeatureSetup update feature with field callback mapping
- fill(data_class_dict: dict[str, Any]) dict[str, Any]
This method fills all the data of the provided data class :param data_class_dict: the values that should be filled in as a dictionary :return: a new data class with the data, that was filled in
- get_element_container() ElementContainerTypeT
This method returns a custom object that will be given to any callback. :return:
- item_mapping() dict[str, balderhub.crud.lib.utils.field_callbacks.field_filler_callback.FieldFillerCallback]
returns a dictionary with the dataclass field name as key and its configuration as value
Setup Factories
- class balderhub.crud.lib.setup_features.factories.AutoSingleReadExampleFactory
Bases:
AutoFeatureFactoryFactory for creating data-item bounded setup-based config-feature
AllMultipleDataConfigby using the defined data within aDataEnvironmentFeature.- classmethod get_for(data_item_cls: type[balderhub.data.lib.utils.single_data_item.SingleDataItem], return_style: Literal['first', 'last', 'random', 'all'] = 'first', **kwargs) type[balderhub.data.lib.scenario_features.abstract_data_item_related_feature.AbstractDataItemRelatedFeature]
Defines a new feature for the specific data-item class given by attribute data_item_cls.
- Parameters:
data_item_cls – the single data-item class
kwargs – optional further attributes that will be forwarded to internal method
AutoFeatureFactory.register_cls()andAutoFeatureFactory._define_class().
- Returns:
the feature type class