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


Python Mock.uid方法代码示例

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


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

示例1: test_node_status_member

# 需要导入模块: from asynctest.mock import Mock [as 别名]
# 或者: from asynctest.mock.Mock import uid [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 uid [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.uid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。