本文整理汇总了Python中tests.functional.MagicMock.available方法的典型用法代码示例。如果您正苦于以下问题:Python MagicMock.available方法的具体用法?Python MagicMock.available怎么用?Python MagicMock.available使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.functional.MagicMock
的用法示例。
在下文中一共展示了MagicMock.available方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_start_presentation_with_no_player
# 需要导入模块: from tests.functional import MagicMock [as 别名]
# 或者: from tests.functional.MagicMock import available [as 别名]
def test_start_presentation_with_no_player(self, media_mock):
"""
Find and chose a controller to play a presentations when the player is not available.
"""
# GIVEN: A single controller and service item wanting to use the controller
mock_item = MagicMock()
mock_item.processor = 'Powerpoint'
mock_item.get_frame_path.return_value = "test.ppt"
self.media_item.automatic = False
mocked_controller = MagicMock()
mocked_controller.available = True
mocked_controller.supports = ['ppt']
mocked_controller1 = MagicMock()
mocked_controller1.available = False
mocked_controller1.supports = ['ppt']
controllers = {
'Impress': mocked_controller,
'Powerpoint': mocked_controller1
}
ml = MessageListener(self.media_item)
ml.media_item = self.media_item
ml.controllers = controllers
ml.preview_handler = MagicMock()
ml.timer = MagicMock()
# WHEN: request the presentation to start
ml.startup([mock_item, False, False, False])
# THEN: The controllers will be setup.
self.assertTrue(len(controllers), 'We have loaded a controller')