本文整理汇总了Python中functions.POST.json方法的典型用法代码示例。如果您正苦于以下问题:Python POST.json方法的具体用法?Python POST.json怎么用?Python POST.json使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类functions.POST
的用法示例。
在下文中一共展示了POST.json方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_01_get_filesystem_listdir
# 需要导入模块: from functions import POST [as 别名]
# 或者: from functions.POST import json [as 别名]
def test_01_get_filesystem_listdir():
results = POST('/filesystem/listdir/', {'path': '/boot'})
assert results.status_code == 200, results.text
assert isinstance(results.json(), list) is True, results.text
assert len(results.json()) > 0, results.text
global listdir
listdir = results
示例2: test_03_check_available_update
# 需要导入模块: from functions import POST [as 别名]
# 或者: from functions.POST import json [as 别名]
def test_03_check_available_update():
global update_version
results = POST('/update/check_available/')
assert results.status_code == 200, results.text
assert isinstance(results.json(), dict) is True, results.text
if results.json()['status'] == 'AVAILABLE':
update_version = results.json()['version']
else:
update_version = None
示例3: test_19_perform_wipe_on_unused_disk
# 需要导入模块: from functions import POST [as 别名]
# 或者: from functions.POST import json [as 别名]
def test_19_perform_wipe_on_unused_disk():
unused_disks = POST('/disk/get_unused/', False)
if len(unused_disks.json()) > 0:
print('in if')
results = POST('/disk/wipe/', {
'dev': unused_disks.json()[0]['name'],
'mode': 'QUICK'
})
assert results.status_code == 200, results.text
示例4: test_10_verify_system_is_ready_to_reboot
# 需要导入模块: from functions import POST [as 别名]
# 或者: from functions.POST import json [as 别名]
def test_10_verify_system_is_ready_to_reboot():
if update_version is None:
pytest.skip('No update found')
elif download_failed is True:
pytest.skip(f'Downloading {selected_trains} failed')
else:
results = POST('/update/check_available/')
assert results.status_code == 200, results.text
assert isinstance(results.json(), dict) is True, results.text
assert results.json()['status'] == 'REBOOT_REQUIRED', results.text
示例5: test_07_get_pending_update
# 需要导入模块: from functions import POST [as 别名]
# 或者: from functions.POST import json [as 别名]
def test_07_get_pending_update():
if update_version is None:
pytest.skip('No update found')
elif download_failed is True:
pytest.skip(f'Downloading {selected_trains} failed')
else:
results = POST('/update/get_pending/')
assert results.status_code == 200, results.text
assert isinstance(results.json(), list) is True, results.text
assert results.json() != [], results.text
示例6: test_05_create_system_tunable_dummynet
# 需要导入模块: from functions import POST [as 别名]
# 或者: from functions.POST import json [as 别名]
def test_05_create_system_tunable_dummynet():
global payload, results, tunable_id
payload = {
"tun_var": "dummynet_load",
"tun_comment": "tunable dummynet test",
"tun_enabled": True,
"tun_value": "YES",
"tun_type": "loader"
}
results = POST("/system/tunable/", payload)
assert results.status_code == 201, results.text
assert isinstance(results.json(), dict) is True, results.text
tunable_id = results.json()['id']
示例7: test_06_get_download_info_for_config_dot_save
# 需要导入模块: from functions import POST [as 别名]
# 或者: from functions.POST import json [as 别名]
def test_06_get_download_info_for_config_dot_save():
payload = {
'method': 'config.save',
'args': [],
'filename': 'freenas.db'
}
results = POST('/core/download/', payload)
assert results.status_code == 200, results.text
assert isinstance(results.json(), list) is True, results.text
global url
url = results.json()[1]
global job_id
job_id = results.json()[0]
示例8: test_07_stop_vm
# 需要导入模块: from functions import POST [as 别名]
# 或者: from functions.POST import json [as 别名]
def test_07_stop_vm(data):
if nested_vm is False:
pytest.skip(message)
else:
results = POST(f'/vm/id/{data["vmid"]}/stop/')
assert results.status_code == 200, results.text
assert isinstance(results.json(), bool) is True, results.text
示例9: test_06_run_cloud_sync
# 需要导入模块: from functions import POST [as 别名]
# 或者: from functions.POST import json [as 别名]
def test_06_run_cloud_sync(env, task):
result = POST(f"/cloudsync/id/{task['id']}/sync/")
assert result.status_code == 200, result.text
for i in range(120):
result = GET(f"/cloudsync/id/{task['id']}/")
assert result.status_code == 200, result.text
state = result.json()
if state["job"] is None:
time.sleep(1)
continue
if state["job"]["state"] in ["PENDING", "RUNNING"]:
time.sleep(1)
continue
assert state["job"]["state"] == "SUCCESS", state
with open(os.path.join(DATASET_PATH, "freenas-test.txt")) as f:
assert f.read() == "freenas-test\n"
return
assert False, state
示例10: test_01_creating_staticroute
# 需要导入模块: from functions import POST [as 别名]
# 或者: from functions.POST import json [as 别名]
def test_01_creating_staticroute(sr_dict):
results = POST('/staticroute/', {
'destination': DESTINATION,
'gateway': GATEWAY,
'description': 'test route',
})
assert results.status_code == 200, results.text
sr_dict['newroute'] = results.json()
示例11: test_03_verify_list_resources_endpoint
# 需要导入模块: from functions import POST [as 别名]
# 或者: from functions.POST import json [as 别名]
def test_03_verify_list_resources_endpoint():
result = POST(
'/jail/list_resource/', {
'resource': 'RELEASE',
}
)
assert isinstance(result.json(), list), result.text
示例12: test_08_install_update
# 需要导入模块: from functions import POST [as 别名]
# 或者: from functions.POST import json [as 别名]
def test_08_install_update():
global reboot
reboot = False
if update_version is None:
pytest.skip('No update found')
elif download_failed is True:
pytest.skip(f'Downloading {selected_trains} failed')
else:
payload = {
"train": selected_trains,
"reboot": reboot
}
results = POST('/update/update/', payload)
global JOB_ID
assert results.status_code == 200, results.text
assert isinstance(results.json(), int) is True, results.text
JOB_ID = results.json()
示例13: test_03_get_stats_data_for_
# 需要导入模块: from functions import POST [as 别名]
# 或者: from functions.POST import json [as 别名]
def test_03_get_stats_data_for_(source):
for _type in source_dict[source]:
payload1 = {'source': source, 'type': _type}
results = POST('/stats/get_dataset_info/', payload1)
assert results.status_code == 200, results.text
info = results.json()
assert isinstance(info, dict) is True
payload2 = {
'stats_list': [{
'source': source,
'type': _type,
'dataset': list(info['datasets'].keys())[0],
}],
}
results = POST('/stats/get_data/', payload2)
assert results.status_code == 200, results.text
assert isinstance(results.json(), dict) is True
示例14: test_05_Associate_ISCSI_target
# 需要导入模块: from functions import POST [as 别名]
# 或者: from functions.POST import json [as 别名]
def test_05_Associate_ISCSI_target():
payload = {
'target': 1,
'lunid': 1,
'extent': 1
}
results = POST("/iscsi/targetextent/", payload)
assert isinstance(results.json(), dict), results.text
示例15: test_06_vm_status
# 需要导入模块: from functions import POST [as 别名]
# 或者: from functions.POST import json [as 别名]
def test_06_vm_status(data):
if nested_vm is False:
pytest.skip(message)
else:
results = POST(f'/vm/id/{data["vmid"]}/status/')
assert results.status_code == 200, results.text
status = results.json()
assert isinstance(status, dict) is True, results.text