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


Python Mock.pubkey方法代碼示例

本文整理匯總了Python中asynctest.mock.Mock.pubkey方法的典型用法代碼示例。如果您正苦於以下問題:Python Mock.pubkey方法的具體用法?Python Mock.pubkey怎麽用?Python Mock.pubkey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在asynctest.mock.Mock的用法示例。


在下文中一共展示了Mock.pubkey方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_node_status_member

# 需要導入模塊: from asynctest.mock import Mock [as 別名]
# 或者: from asynctest.mock.Mock import pubkey [as 別名]
    def test_node_status_member(self, app, community):
        community.parameters = CoroutineMock(return_value = {'sigValidity': 1000})

        base_graph = BaseGraph(app, community)
        certifier = Mock(specs='core.registry.Identity')
        certifier.pubkey = "7Aqw6Efa9EzE7gtsc8SveLLrM7gm6NEGoywSv4FJx6pZ"
        certifier.uid = "first_identity"
        certifier.is_member = CoroutineMock(spec='core.registry.Identity.is_member', return_value=False)

        account_identity = Mock(specs='core.registry.Identity')
        account_identity.pubkey = "FADxcH5LmXGmGFgdixSes6nWnC4Vb4pRUBYT81zQRhjn"
        account_identity.uid = "second_uid"
        account_identity.is_member = CoroutineMock(spec='core.registry.Identity.is_member', return_value=True)

        async def exec_test():
            self.assertEquals((await base_graph.node_status(certifier, account_identity)), NodeStatus.OUT)
            self.assertEquals((await base_graph.node_status(account_identity, account_identity)), NodeStatus.HIGHLIGHTED)

        self.lp.run_until_complete(exec_test())
開發者ID:c-geek,項目名稱:sakia,代碼行數:21,代碼來源:test_base_graph.py

示例2: test_explore_to_find_unknown

# 需要導入模塊: from asynctest.mock import Mock [as 別名]
# 或者: from asynctest.mock.Mock import pubkey [as 別名]
    def test_explore_to_find_unknown(self, app, community):
        community.parameters = CoroutineMock(return_value = {'sigValidity': 1000})
        community.network.confirmations = Mock(side_effect=lambda n: 4 if 996 else None)
        app.preferences = {'expert_mode': True}

        wot_graph = WoTGraph(app, community)

        identity_unknown = Mock(specs='core.registry.Identity')
        identity_unknown.pubkey = "8Fi1VSTbjkXguwThF4v2ZxC5whK7pwG2vcGTkPUPjPGU"
        identity_unknown.uid = "unkwn"

        async def exec_test():
            result = await wot_graph.explore_to_find_member(self.account_identity, identity_unknown)
            self.assertFalse(result)
            self.assertEqual(len(wot_graph.nx_graph.nodes()), 3)
            self.assertEqual(len(wot_graph.nx_graph.edges()), 2)

        self.lp.run_until_complete(exec_test())
開發者ID:pierreloicq,項目名稱:sakia,代碼行數:20,代碼來源:test_wot_graph.py


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