- added get_generator API to testing utilities (a nice way to setup default options)

This commit is contained in:
Wryn (yage) Wagner 2024-04-15 08:46:47 -06:00
parent 1f10268aa0
commit 6ba628f80e
2 changed files with 16 additions and 1 deletions

View File

@ -5,6 +5,6 @@ __all__ = [
'generate', 'generate',
] ]
from .generate import generate from .generate import generate, get_generator
from .character_set import * from .character_set import *

View File

@ -45,6 +45,21 @@ DEFAULT_OPTIONS = {
'requests_response_status_code': status_codes.codes[200], '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): def generate(data_type=None, options=None):
''' '''
generate random data with the call of a function generate random data with the call of a function