mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-11 18:11:21 +08:00
37 lines
1.1 KiB
YAML
37 lines
1.1 KiB
YAML
bind_variables:
|
|
variables:
|
|
- TOKEN: "debugtalk"
|
|
- token: $TOKEN
|
|
|
|
bind_lambda_functions:
|
|
function_binds:
|
|
add_one: "lambda x: x + 1"
|
|
add_two_nums: "lambda x, y: x + y"
|
|
variables:
|
|
- add1: ${add_one(2)}
|
|
- sum2nums: ${add_two_nums(2, 3)}
|
|
|
|
bind_lambda_functions_with_import:
|
|
requires:
|
|
- random
|
|
- string
|
|
- hashlib
|
|
function_binds:
|
|
gen_random_string: "lambda str_len: ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(str_len))"
|
|
gen_md5: "lambda *str_args: hashlib.md5(''.join(str_args).encode('utf-8')).hexdigest()"
|
|
variables:
|
|
- TOKEN: debugtalk
|
|
- random: ${gen_random_string(5)}
|
|
- data: "{'name': 'user', 'password': '123456'}"
|
|
- authorization: ${gen_md5($TOKEN, $data, $random)}
|
|
|
|
bind_module_functions:
|
|
function_binds:
|
|
import_module_items:
|
|
- tests.data.debugtalk
|
|
variables:
|
|
- TOKEN: debugtalk
|
|
- random: ${gen_random_string(5)}
|
|
- data: "{'name': 'user', 'password': '123456'}"
|
|
- authorization: ${gen_md5($TOKEN, $data, $random)}
|