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


Python MockObject.notify方法代码示例

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


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

示例1: setUp

# 需要导入模块: from Tribler.Test.Core.base_test import MockObject [as 别名]
# 或者: from Tribler.Test.Core.base_test.MockObject import notify [as 别名]
    def setUp(self):
        """
        Setup some classes and files that are used by the tests in this module.
        """
        yield super(BaseTestChannel, self).setUp()

        self.fake_session = MockObject()
        self.fake_session.add_observer = lambda a, b, c: False

        self.fake_session_config = MockObject()
        self.fake_session_config.get_state_dir = lambda: self.session_base_dir
        self.fake_session.config = self.fake_session_config

        fake_notifier = MockObject()
        fake_notifier.add_observer = lambda a, b, c, d: False
        fake_notifier.notify = lambda a, b, c, d: False
        self.fake_session.notifier = fake_notifier

        self.fake_channel_community = MockObject()
        self.fake_channel_community.get_channel_id = lambda: 42
        self.fake_channel_community.cid = 'a' * 20
        self.fake_channel_community.get_channel_name = lambda: "my fancy channel"

        self.channel_db_handler = self.session.open_dbhandler(NTFY_CHANNELCAST)
        self.votecast_db_handler = self.session.open_dbhandler(NTFY_VOTECAST)

        self.session.get_dispersy = lambda: True
        self.session.lm.dispersy = Dispersy(ManualEnpoint(0), self.getStateDir())
开发者ID:synctext,项目名称:tribler,代码行数:30,代码来源:base_test_channel.py

示例2: setUp

# 需要导入模块: from Tribler.Test.Core.base_test import MockObject [as 别名]
# 或者: from Tribler.Test.Core.base_test.MockObject import notify [as 别名]
    def setUp(self):
        TriblerCoreTest.setUp(self)
        self.lm = TriblerLaunchMany()
        self.lm.session_lock = NoDispersyRLock()
        self.lm.session = MockObject()
        self.lm.session.config = MockObject()
        self.lm.session.config.get_max_upload_rate = lambda: 100
        self.lm.session.config.get_max_download_rate = lambda: 100
        self.lm.session.config.get_default_number_hops = lambda: 0

        # Ignore notifications
        mock_notifier = MockObject()
        mock_notifier.notify = lambda *_: None
        self.lm.session.notifier = mock_notifier
开发者ID:synctext,项目名称:tribler,代码行数:16,代码来源:test_launch_many_cores.py


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