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


Python HTTPSOAPWrapper._create_headers方法代码示例

本文整理汇总了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)
开发者ID:giacomocariello,项目名称:zato,代码行数:28,代码来源:test_outgoing.py

示例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)
开发者ID:giacomocariello,项目名称:zato,代码行数:22,代码来源:test_outgoing.py

示例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)
开发者ID:giacomocariello,项目名称:zato,代码行数:24,代码来源:test_outgoing.py


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