本文整理汇总了Python中pyon.ion.endpoint.ProcessEndpointUnitMixin类的典型用法代码示例。如果您正苦于以下问题:Python ProcessEndpointUnitMixin类的具体用法?Python ProcessEndpointUnitMixin怎么用?Python ProcessEndpointUnitMixin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProcessEndpointUnitMixin类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test__intercept_msg_out
def test__intercept_msg_out(self, mocknpi, mockipi):
mockipi.return_value = sentinel.inv2
mocknpi.return_value = sentinel.inv2
ep = ProcessEndpointUnitMixin(process=sentinel.proc, interceptors=sentinel_interceptors)
ep._intercept_msg_out(sentinel.inv)
mockipi.assert_has_calls([call(sentinel.proc_outgoing, sentinel.inv)])
mocknpi.assert_has_calls([call(sentinel.msg_outgoing, sentinel.inv2)])
示例2: test__build_header_no_context
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)
示例3: test__build_header_service
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)
示例4: _build_security_headers
def _build_security_headers(self):
"""
Builds additional security headers to be passed through to EMS.
"""
# pull context from container
ctx = self.container.context.get_context()
if isinstance(ctx, dict):
return ProcessEndpointUnitMixin.build_security_headers(ctx)
return None
示例5: test__build_header_with_context
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)
示例6: test__get_sflow_manager
def test__get_sflow_manager(self):
ep = ProcessEndpointUnitMixin(process=Mock())
self.assertEquals(ep._get_sflow_manager(), ep._process.container.sflow_manager)
示例7: test__build_invocation
def test__build_invocation(self, mockbi):
ep = ProcessEndpointUnitMixin(process=sentinel.proc)
ep._build_invocation(invother=sentinel.anything)
mockbi.assert_called_once_with(ep, process=sentinel.proc, invother=sentinel.anything)
示例8: test__get_sample_name
def test__get_sample_name(self):
ep = ProcessEndpointUnitMixin(process=Mock())
self.assertEquals(ep._get_sample_name(), str(ep._process.id))