當前位置: 首頁>>代碼示例>>Python>>正文


Python endpoint.ProcessEndpointUnitMixin類代碼示例

本文整理匯總了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)])
開發者ID:daf,項目名稱:pyon,代碼行數:9,代碼來源:test_endpoint.py

示例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)
開發者ID:daf,項目名稱:pyon,代碼行數:14,代碼來源:test_endpoint.py

示例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)
開發者ID:daf,項目名稱:pyon,代碼行數:19,代碼來源:test_endpoint.py

示例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
開發者ID:daf,項目名稱:pyon,代碼行數:11,代碼來源:exchange.py

示例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)
開發者ID:daf,項目名稱:pyon,代碼行數:23,代碼來源:test_endpoint.py

示例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)
開發者ID:daf,項目名稱:pyon,代碼行數:3,代碼來源:test_endpoint.py

示例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)
開發者ID:daf,項目名稱:pyon,代碼行數:5,代碼來源:test_endpoint.py

示例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))
開發者ID:swarbhanu,項目名稱:pyon,代碼行數:3,代碼來源:test_endpoint.py


注:本文中的pyon.ion.endpoint.ProcessEndpointUnitMixin類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。