当前位置: 首页>>代码示例>>Python>>正文


Python functions.POST类代码示例

本文整理汇总了Python中functions.POST的典型用法代码示例。如果您正苦于以下问题:Python POST类的具体用法?Python POST怎么用?Python POST使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了POST类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_07_stop_vm

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
开发者ID:freenas,项目名称:freenas,代码行数:7,代码来源:vm.py

示例2: test_01_get_filesystem_listdir

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
开发者ID:freenas,项目名称:freenas,代码行数:7,代码来源:filesystem.py

示例3: test_06_run_cloud_sync

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
开发者ID:razzfazz,项目名称:freenas,代码行数:28,代码来源:cloud_sync.py

示例4: test_01_creating_staticroute

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()
开发者ID:freenas,项目名称:freenas,代码行数:8,代码来源:staticroute.py

示例5: test_06_vm_status

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
开发者ID:freenas,项目名称:freenas,代码行数:8,代码来源:vm.py

示例6: test_05_Associate_ISCSI_target

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
开发者ID:freenas,项目名称:freenas,代码行数:8,代码来源:iscsi.py

示例7: test_03_verify_list_resources_endpoint

def test_03_verify_list_resources_endpoint():
    result = POST(
        '/jail/list_resource/', {
            'resource': 'RELEASE',
        }
    )

    assert isinstance(result.json(), list), result.text
开发者ID:razzfazz,项目名称:freenas,代码行数:8,代码来源:jails.py

示例8: test_04_Add_ISCSI_extent

def test_04_Add_ISCSI_extent():
    payload = {
        'type': 'FILE',
        'name': 'extent',
        'filesize': 536870912,
        'path': f'/mnt/{pool_name}/dataset03/iscsi'
    }
    results = POST("/iscsi/extent/", payload)
    assert isinstance(results.json(), dict), results.text
开发者ID:freenas,项目名称:freenas,代码行数:9,代码来源:iscsi.py

示例9: test_03_Create_initshutdownscript_script

def test_03_Create_initshutdownscript_script(initshutdownsc_dict):
    results = POST('/initshutdownscript', {
        'type': 'SCRIPT',
        'script': TESTSCRIPT,
        'when': 'POSTINIT'
    })
    assert results.status_code == 200, results.text
    initshutdownsc_dict.update(results.json())
    assert isinstance(initshutdownsc_dict['id'], int) is True
开发者ID:freenas,项目名称:freenas,代码行数:9,代码来源:initshutdownscript.py

示例10: test_01_Create_initshutdownscript_command

def test_01_Create_initshutdownscript_command(initshutdowncmd_dict):
    results = POST('/initshutdownscript/', {
        'type': 'COMMAND',
        'command': TESTCMD,
        'when': 'PREINIT'
    })
    assert results.status_code == 200, results.text
    initshutdowncmd_dict.update(results.json())
    assert isinstance(initshutdowncmd_dict['id'], int) is True
开发者ID:freenas,项目名称:freenas,代码行数:9,代码来源:initshutdownscript.py

示例11: test_03_check_available_update

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
开发者ID:freenas,项目名称:freenas,代码行数:9,代码来源:update.py

示例12: test_02_Creating_WebDAV_share_on_DATASET_PATH

def test_02_Creating_WebDAV_share_on_DATASET_PATH(webdav_dict):
    results = POST('/sharing/webdav/', {
        'name': SHARE_NAME,
        'comment': 'Auto-created by API tests',
        'path': DATASET_PATH
    })
    assert results.status_code == 200, results.text
    webdav_dict.update(results.json())
    assert isinstance(webdav_dict['id'], int) is True
开发者ID:razzfazz,项目名称:freenas,代码行数:9,代码来源:webdav_bsd.py

示例13: test_02_create_vmware

def test_02_create_vmware(data):
    payload = {
        'hostname': os.environ['VMWARE_HOST'],
        'username': os.environ['VMWARE_USERNAME'],
        'password': os.environ['VMWARE_PASSWORD']
    }
    results = POST('/vmware/get_datastores/', payload)
    assert results.status_code == 200, results.text
    assert isinstance(results.json(), list) is True, results.text
开发者ID:freenas,项目名称:freenas,代码行数:9,代码来源:vmware.py

示例14: test_12_exec_call

def test_12_exec_call():
    result = POST(
        '/jail/exec', {
            'jail': JAIL_NAME,
            'command': ['echo "exec successful"']
        }
    )

    assert 'exec successful' in result.json().lower(), result.text
开发者ID:razzfazz,项目名称:freenas,代码行数:9,代码来源:jails.py

示例15: test_01_Creating_new_cron_job_which_will_run_every_minute

def test_01_Creating_new_cron_job_which_will_run_every_minute(cronjob_dict):
    results = POST('/cronjob', {
        'user': 'root',
        'command': f'touch "{TESTFILE}"',
        'schedule': {'minute': '*/1'}
    })
    assert results.status_code == 200, results.text
    cronjob_dict.update(results.json())
    assert isinstance(cronjob_dict['id'], int) is True
开发者ID:razzfazz,项目名称:freenas,代码行数:9,代码来源:cronjob.py


注:本文中的functions.POST类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。