- added get_generator API to testing utilities (a nice way to setup default options)
This commit is contained in:
parent
1f10268aa0
commit
6ba628f80e
@ -5,6 +5,6 @@ __all__ = [
|
||||
'generate',
|
||||
]
|
||||
|
||||
from .generate import generate
|
||||
from .generate import generate, get_generator
|
||||
|
||||
from .character_set import *
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user