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


Python testing.TestClient方法代码示例

本文整理汇总了Python中falcon.testing.TestClient方法的典型用法代码示例。如果您正苦于以下问题:Python testing.TestClient方法的具体用法?Python testing.TestClient怎么用?Python testing.TestClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在falcon.testing的用法示例。


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

示例1: setUp

# 需要导入模块: from falcon import testing [as 别名]
# 或者: from falcon.testing import TestClient [as 别名]
def setUp(self):
        super(BaseControllerTest, self).setUp()
        # Override the default configuration file lookup with references to
        # the sample configuration files to avoid oslo.conf errors when
        # creating the server below.
        current_dir = os.path.dirname(os.path.realpath(__file__))
        sample_conf_dir = os.path.join(
            current_dir, os.pardir, os.pardir, os.pardir, os.pardir, 'etc',
            'armada')
        sample_conf_files = ['api-paste.ini', 'armada.conf.sample']
        with mock.patch.object(armada.conf,
                               '_get_config_files') as mock_get_config_files:
            mock_get_config_files.return_value = [
                os.path.join(sample_conf_dir, x) for x in sample_conf_files
            ]
            self.app = falcon_testing.TestClient(
                server.create(enable_middleware=False))
        self.policy = self.useFixture(fixtures.RealPolicyFixture()) 
开发者ID:airshipit,项目名称:armada,代码行数:20,代码来源:base.py

示例2: setUp

# 需要导入模块: from falcon import testing [as 别名]
# 或者: from falcon.testing import TestClient [as 别名]
def setUp(self):
        super(BaseControllerTest, self).setUp()
        # Override the default configuration file lookup with references to
        # the sample configuration files to avoid oslo.conf errors when
        # creating the server below.
        current_dir = os.path.dirname(os.path.realpath(__file__))
        sample_conf_dir = os.path.join(current_dir, os.pardir, os.pardir,
                                       os.pardir, os.pardir, 'etc', 'armada')
        sample_conf_files = ['api-paste.ini', 'armada.conf.sample']
        with mock.patch.object(
                armada.conf, '_get_config_files') as mock_get_config_files:
            mock_get_config_files.return_value = [
                os.path.join(sample_conf_dir, x) for x in sample_conf_files
            ]
            self.app = falcon_testing.TestClient(
                server.create(enable_middleware=False))
        self.policy = self.useFixture(fixtures.RealPolicyFixture()) 
开发者ID:att-comdev,项目名称:armada,代码行数:19,代码来源:base.py

示例3: test_both_schemas_validation_failure

# 需要导入模块: from falcon import testing [as 别名]
# 或者: from falcon.testing import TestClient [as 别名]
def test_both_schemas_validation_failure():
    with pytest.raises(HTTPError) as excinfo:
        Resource().both_validated(GoodData(), BadData())

    assert excinfo.value.title == falcon.HTTP_INTERNAL_SERVER_ERROR
    assert excinfo.value.description == "Response data failed validation"

    with pytest.raises(HTTPError) as excinfo:
        Resource().both_validated(BadData(), GoodData())

    msg = "Request data failed validation: data must contain ['message'] properties"
    assert excinfo.value.title == falcon.HTTP_BAD_REQUEST
    assert excinfo.value.description == msg

    client = testing.TestClient(falcon.API())
    client.app.add_route("/test", Resource())
    result = client.simulate_put("/test", json=BadData.media)
    assert result.status_code == 400 
开发者ID:alexferl,项目名称:falcon-boilerplate,代码行数:20,代码来源:test_validators.py

示例4: falcontest

# 需要导入模块: from falcon import testing [as 别名]
# 或者: from falcon.testing import TestClient [as 别名]
def falcontest(self, drydock_state, deckhand_ingester,
                   deckhand_orchestrator):
        """Create a test harness for the Falcon API framework."""
        policy.policy_engine = policy.DrydockPolicy()
        policy.policy_engine.register_policy()

        return testing.TestClient(
            start_api(
                state_manager=drydock_state,
                ingester=deckhand_ingester,
                orchestrator=deckhand_orchestrator)) 
开发者ID:airshipit,项目名称:drydock,代码行数:13,代码来源:test_api_builddata.py

示例5: falcontest

# 需要导入模块: from falcon import testing [as 别名]
# 或者: from falcon.testing import TestClient [as 别名]
def falcontest(self, drydock_state, deckhand_ingester,
                   deckhand_orchestrator, mock_get_build_data):
        """Create a test harness for the Falcon API framework."""
        return testing.TestClient(
            start_api(
                state_manager=drydock_state,
                ingester=deckhand_ingester,
                orchestrator=deckhand_orchestrator)) 
开发者ID:airshipit,项目名称:drydock,代码行数:10,代码来源:test_bootaction_context.py

示例6: falcontest

# 需要导入模块: from falcon import testing [as 别名]
# 或者: from falcon.testing import TestClient [as 别名]
def falcontest(self, drydock_state, yaml_ingester, yaml_orchestrator):
        """Create a test harness for the Falcon API framework."""
        return testing.TestClient(
            start_api(
                state_manager=drydock_state,
                ingester=yaml_ingester,
                orchestrator=yaml_orchestrator)) 
开发者ID:airshipit,项目名称:drydock,代码行数:9,代码来源:test_api_bootaction_status.py

示例7: falcontest

# 需要导入模块: from falcon import testing [as 别名]
# 或者: from falcon.testing import TestClient [as 别名]
def falcontest(self, drydock_state, yaml_ingester, yaml_orchestrator,
                   mock_get_build_data):
        """Create a test harness for the Falcon API framework."""
        return testing.TestClient(
            start_api(
                state_manager=drydock_state,
                ingester=yaml_ingester,
                orchestrator=yaml_orchestrator)) 
开发者ID:airshipit,项目名称:drydock,代码行数:10,代码来源:test_api_bootaction.py

示例8: falcontest

# 需要导入模块: from falcon import testing [as 别名]
# 或者: from falcon.testing import TestClient [as 别名]
def falcontest(self, drydock_state, deckhand_ingester,
                   deckhand_orchestrator, mock_get_build_data):
        """Create a test harness for the Falcon API framework."""
        policy.policy_engine = policy.DrydockPolicy()
        policy.policy_engine.register_policy()

        return testing.TestClient(
            start_api(
                state_manager=drydock_state,
                ingester=deckhand_ingester,
                orchestrator=deckhand_orchestrator)) 
开发者ID:airshipit,项目名称:drydock,代码行数:13,代码来源:test_api_nodes_unit.py

示例9: client

# 需要导入模块: from falcon import testing [as 别名]
# 或者: from falcon.testing import TestClient [as 别名]
def client():
    from certidude.api import certidude_app
    from falcon import testing
    app = certidude_app()
    return testing.TestClient(app) 
开发者ID:laurivosandi,项目名称:certidude,代码行数:7,代码来源:test_cli.py

示例10: client

# 需要导入模块: from falcon import testing [as 别名]
# 或者: from falcon.testing import TestClient [as 别名]
def client():
    return testing.TestClient(app) 
开发者ID:0b01001001,项目名称:spectree,代码行数:4,代码来源:test_plugin_falcon.py

示例11: client

# 需要导入模块: from falcon import testing [as 别名]
# 或者: from falcon.testing import TestClient [as 别名]
def client(get_fake_model):
    rest_api = create_rest_api(models={"test": get_fake_model})
    return testing.TestClient(rest_api) 
开发者ID:openvinotoolkit,项目名称:model_server,代码行数:5,代码来源:conftest.py

示例12: client

# 需要导入模块: from falcon import testing [as 别名]
# 或者: from falcon.testing import TestClient [as 别名]
def client(app):
    return testing.TestClient(app) 
开发者ID:loanzen,项目名称:falcon-auth,代码行数:4,代码来源:conftest.py

示例13: client

# 需要导入模块: from falcon import testing [as 别名]
# 或者: from falcon.testing import TestClient [as 别名]
def client():
    with mock.patch('management_api.main.AuthMiddleware') as middleware:
        middleware.return_value = AuthMiddlewareMock()
        return testing.TestClient(create_app()) 
开发者ID:IntelAI,项目名称:inference-model-manager,代码行数:6,代码来源:conftest.py

示例14: client_with_auth

# 需要导入模块: from falcon import testing [as 别名]
# 或者: from falcon.testing import TestClient [as 别名]
def client_with_auth():
    return testing.TestClient(create_app()) 
开发者ID:IntelAI,项目名称:inference-model-manager,代码行数:4,代码来源:conftest.py

示例15: client

# 需要导入模块: from falcon import testing [as 别名]
# 或者: from falcon.testing import TestClient [as 别名]
def client(self, app):
        return TestClient(app) 
开发者ID:p1c2u,项目名称:openapi-core,代码行数:4,代码来源:test_falcon_middlewares.py


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