diff --git a/py/lib/scwrypts/test/__init__.py b/py/lib/scwrypts/test/__init__.py index 5bbca56..5be3205 100644 --- a/py/lib/scwrypts/test/__init__.py +++ b/py/lib/scwrypts/test/__init__.py @@ -5,6 +5,6 @@ __all__ = [ 'generate', ] -from .generate import generate +from .generate import generate, get_generator from .character_set import * diff --git a/py/lib/scwrypts/test/generate.py b/py/lib/scwrypts/test/generate.py index eed70fd..5f6e5cb 100644 --- a/py/lib/scwrypts/test/generate.py +++ b/py/lib/scwrypts/test/generate.py @@ -45,6 +45,21 @@ DEFAULT_OPTIONS = { 'requests_response_status_code': status_codes.codes[200], } +def get_generator(default_options=None): + if default_options is None: + default_options = {} + + def generator_function(data_type=None, options_overrides=None): + if options_overrides is None: + options_overrides = {} + + return generate( + data_type = data_type, + options = default_options | options_overrides, + ) + + return generator_function + def generate(data_type=None, options=None): ''' generate random data with the call of a function