mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-24 09:50:00 +08:00
Add example
This commit is contained in:
0
docs/examples/test_klook/utils/__init__.py
Normal file
0
docs/examples/test_klook/utils/__init__.py
Normal file
0
docs/examples/test_klook/utils/setup_hooks.py
Normal file
0
docs/examples/test_klook/utils/setup_hooks.py
Normal file
6
docs/examples/test_klook/utils/teardown_hooks.py
Normal file
6
docs/examples/test_klook/utils/teardown_hooks.py
Normal file
@@ -0,0 +1,6 @@
|
||||
def teardown_hook_set_encoding(response, encoding):
|
||||
"""
|
||||
Set encoding of response.
|
||||
"""
|
||||
response.resp_obj.encoding = encoding
|
||||
return response
|
||||
@@ -0,0 +1,18 @@
|
||||
def check_search_area_result(content, expect_name):
|
||||
print(content, expect_name)
|
||||
found = False
|
||||
for item in content:
|
||||
if item['fullName'] == expect_name:
|
||||
found = True
|
||||
break
|
||||
assert found
|
||||
|
||||
|
||||
def exists_default_group(content, expect):
|
||||
found = False
|
||||
for item in content:
|
||||
if item['defaultGroup']:
|
||||
print('defaultGroup found, id={}, parentAreaId={}'.format(item['id'], item['parentAreaId']))
|
||||
found = True
|
||||
break
|
||||
assert found
|
||||
@@ -0,0 +1,3 @@
|
||||
def klook_len_eq(check_value, expect_value):
|
||||
# 校验列表、字典、字符串等长度是否相等
|
||||
assert len(check_value) == int(expect_value)
|
||||
Reference in New Issue
Block a user