本文整理汇总了Python中zato.server.connection.http_soap.outgoing.HTTPSOAPWrapper._create_headers方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPSOAPWrapper._create_headers方法的具体用法?Python HTTPSOAPWrapper._create_headers怎么用?Python HTTPSOAPWrapper._create_headers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zato.server.connection.http_soap.outgoing.HTTPSOAPWrapper
的用法示例。
在下文中一共展示了HTTPSOAPWrapper._create_headers方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_create_headers_soap12
# 需要导入模块: from zato.server.connection.http_soap.outgoing import HTTPSOAPWrapper [as 别名]
# 或者: from zato.server.connection.http_soap.outgoing.HTTPSOAPWrapper import _create_headers [as 别名]
def test_create_headers_soap12(self):
cid = rand_string()
now = datetime.utcnow().isoformat()
soap_action = rand_string()
requests_module = _FakeRequestsModule()
config = self._get_config()
config['data_format'] = DATA_FORMAT.XML
config['transport'] = URL_TYPE.SOAP
config['soap_action'] = soap_action
config['soap_version'] = '1.2'
wrapper = HTTPSOAPWrapper(config, requests_module)
user_headers = {rand_string():rand_string(), rand_string():rand_string()}
headers = wrapper._create_headers(cid, user_headers, now)
eq_(headers.pop('X-Zato-CID'), cid)
eq_(headers.pop('X-Zato-Msg-TS'), now)
eq_(headers.pop('X-Zato-Component'), get_component_name())
eq_(headers.pop('SOAPAction'), soap_action)
eq_(headers.pop('Content-Type'), CONTENT_TYPE.SOAP12)
# Anything that is left must be user headers
self.assertDictEqual(headers, user_headers)
示例2: test_create_headers_no_data_format
# 需要导入模块: from zato.server.connection.http_soap.outgoing import HTTPSOAPWrapper [as 别名]
# 或者: from zato.server.connection.http_soap.outgoing.HTTPSOAPWrapper import _create_headers [as 别名]
def test_create_headers_no_data_format(self):
cid = rand_string()
now = datetime.utcnow().isoformat()
requests_module = _FakeRequestsModule()
config = self._get_config()
wrapper = HTTPSOAPWrapper(config, requests_module)
user_headers = {rand_string():rand_string(), rand_string():rand_string()}
headers = wrapper._create_headers(cid, user_headers, now)
eq_(headers.pop('X-Zato-CID'), cid)
eq_(headers.pop('X-Zato-Msg-TS'), now)
eq_(headers.pop('X-Zato-Component'), get_component_name())
# Anything that is left must be user headers
# (note that there was no Content-Type because there was no data_format)
self.assertDictEqual(headers, user_headers)
示例3: test_create_headers_json
# 需要导入模块: from zato.server.connection.http_soap.outgoing import HTTPSOAPWrapper [as 别名]
# 或者: from zato.server.connection.http_soap.outgoing.HTTPSOAPWrapper import _create_headers [as 别名]
def test_create_headers_json(self):
cid = rand_string()
now = datetime.utcnow().isoformat()
requests_module = _FakeRequestsModule()
config = self._get_config()
config['data_format'] = DATA_FORMAT.JSON
config['transport'] = URL_TYPE.PLAIN_HTTP
wrapper = HTTPSOAPWrapper(config, requests_module)
user_headers = {rand_string():rand_string(), rand_string():rand_string()}
headers = wrapper._create_headers(cid, user_headers, now)
eq_(headers.pop('X-Zato-CID'), cid)
eq_(headers.pop('X-Zato-Msg-TS'), now)
eq_(headers.pop('X-Zato-Component'), get_component_name())
eq_(headers.pop('Content-Type'), CONTENT_TYPE.JSON)
# Anything that is left must be user headers
self.assertDictEqual(headers, user_headers)