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


Python ProcessEndpointUnitMixin._build_header方法代码示例

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


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

示例1: test__build_header_no_context

# 需要导入模块: from pyon.ion.endpoint import ProcessEndpointUnitMixin [as 别名]
# 或者: from pyon.ion.endpoint.ProcessEndpointUnitMixin import _build_header [as 别名]
    def test__build_header_no_context(self, mockgci):
        ep = ProcessEndpointUnitMixin(process=Mock())
        header = ep._build_header(sentinel.raw_msg, {})

        self.assertIn('sender-name', header)
        self.assertIn('sender', header)
        self.assertIn('sender-type', header)
        self.assertNotIn('sender-service', header)
        self.assertIn('origin-container-id', header)

        self.assertEquals(header['sender-name'], ep._process.name)
        self.assertEquals(header['sender'], ep._process.id)
        self.assertEquals(header['sender-type'], ep._process.process_type)
        self.assertEquals(header['origin-container-id'], mockgci().id)
开发者ID:daf,项目名称:pyon,代码行数:16,代码来源:test_endpoint.py

示例2: test__build_header_service

# 需要导入模块: from pyon.ion.endpoint import ProcessEndpointUnitMixin [as 别名]
# 或者: from pyon.ion.endpoint.ProcessEndpointUnitMixin import _build_header [as 别名]
    def test__build_header_service(self, mockgci):
        procmock = Mock()
        procmock.process_type = 'service'

        ep = ProcessEndpointUnitMixin(process=procmock)
        ep.channel = Mock(spec=SendChannel)
        header = ep._build_header(sentinel.raw_msg, {})

        self.assertIn('sender-name', header)
        self.assertIn('sender', header)
        self.assertIn('sender-type', header)
        self.assertIn('sender-service', header)
        self.assertIn('origin-container-id', header)

        self.assertEquals(header['sender-name'], ep._process.name)
        self.assertEquals(header['sender'], ep._process.id)
        self.assertEquals(header['sender-type'], ep._process.process_type)
        self.assertEquals(header['sender-service'], "%s,%s" % (ep.channel._send_name.exchange, procmock.name))
        self.assertEquals(header['origin-container-id'], mockgci().id)
开发者ID:daf,项目名称:pyon,代码行数:21,代码来源:test_endpoint.py

示例3: test__build_header_with_context

# 需要导入模块: from pyon.ion.endpoint import ProcessEndpointUnitMixin [as 别名]
# 或者: from pyon.ion.endpoint.ProcessEndpointUnitMixin import _build_header [as 别名]
    def test__build_header_with_context(self, mockgci):
        procmock = Mock()
        procmock.get_context.return_value={'ion-actor-id': sentinel.ion_actor_id,
                                           'ion-actor-roles': sentinel.ion_actor_roles,
                                           'ion-actor-tokens': sentinel.ion_actor_tokens,
                                           'expiry': sentinel.expiry,
                                           'origin-container-id': sentinel.container_id}

        ep = ProcessEndpointUnitMixin(process=procmock)
        ep.channel = Mock(spec=SendChannel)
        header = ep._build_header(sentinel.raw_msg, {})

        self.assertIn('ion-actor-id', header)
        self.assertIn('ion-actor-roles', header)
        self.assertIn('ion-actor-tokens', header)
        self.assertIn('expiry', header)
        self.assertIn('origin-container-id', header)

        self.assertEquals(header['ion-actor-id'], sentinel.ion_actor_id)
        self.assertEquals(header['ion-actor-roles'], sentinel.ion_actor_roles)
        self.assertEquals(header['ion-actor-tokens'], sentinel.ion_actor_tokens)
        self.assertEquals(header['expiry'], sentinel.expiry)
        self.assertEquals(header['origin-container-id'], sentinel.container_id)
开发者ID:daf,项目名称:pyon,代码行数:25,代码来源:test_endpoint.py


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