本文整理汇总了Python中zato.server.connection.http_soap.outgoing.HTTPSOAPWrapper.http_request方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPSOAPWrapper.http_request方法的具体用法?Python HTTPSOAPWrapper.http_request怎么用?Python HTTPSOAPWrapper.http_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zato.server.connection.http_soap.outgoing.HTTPSOAPWrapper
的用法示例。
在下文中一共展示了HTTPSOAPWrapper.http_request方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_http_methods
# 需要导入模块: from zato.server.connection.http_soap.outgoing import HTTPSOAPWrapper [as 别名]
# 或者: from zato.server.connection.http_soap.outgoing.HTTPSOAPWrapper import http_request [as 别名]
def test_http_methods(self):
address_host = rand_string()
config = self._get_config()
config['is_active'] = True
config['soap_version'] = '1.2'
config['address_host'] = address_host
requests_module = _FakeRequestsModule()
wrapper = HTTPSOAPWrapper(config, requests_module)
for address_url_path in('/zzz', '/a/{a}/b/{b}'):
for transport in('soap', rand_string()):
for name in('get', 'delete', 'options', 'post', 'put', 'patch'):
config['transport'] = transport
_cid = rand_string()
_data = rand_string()
expected_http_request_value = rand_string()
expected_http_request_value = rand_string()
expected_params = rand_string()
expected_args1 = rand_string()
expected_args2 = rand_string()
expected_kwargs1 = rand_string()
expected_kwargs2 = rand_string()
def http_request(method, cid, data='', params=None, *args, **kwargs):
eq_(method, name.upper())
eq_(cid, _cid)
if name in('get', 'delete', 'options'):
eq_(data, '')
else:
eq_(data, _data)
eq_(params, expected_params)
eq_(args, (expected_args1, expected_args2))
eq_(sorted(kwargs.items()), [('bar', expected_kwargs2), ('foo', expected_kwargs1)])
return expected_http_request_value
def format_address(cid, params):
return expected_http_request_value
wrapper.http_request = http_request
wrapper.format_address = format_address
func = getattr(wrapper, name)
if name in('get', 'delete', 'options'):
http_request_value = func(
_cid, expected_params, expected_args1, expected_args2,
foo=expected_kwargs1, bar=expected_kwargs2)
else:
http_request_value = func(
_cid, _data, expected_params, expected_args1, expected_args2,
foo=expected_kwargs1, bar=expected_kwargs2)
eq_(http_request_value, expected_http_request_value)