本文整理汇总了Python中tests.functional.MagicMock.unique_identifier方法的典型用法代码示例。如果您正苦于以下问题:Python MagicMock.unique_identifier方法的具体用法?Python MagicMock.unique_identifier怎么用?Python MagicMock.unique_identifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.functional.MagicMock
的用法示例。
在下文中一共展示了MagicMock.unique_identifier方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_go_live_service_manager_test
# 需要导入模块: from tests.functional import MagicMock [as 别名]
# 或者: from tests.functional.MagicMock import unique_identifier [as 别名]
def on_go_live_service_manager_test(self):
"""
Test that when the on_go_live() method is called the message is sent to the live controller and focus is
set correctly.
"""
# GIVEN: A new SlideController instance and service manager preview then pressing go live should respond
mocked_display = MagicMock()
mocked_service_manager = MagicMock()
mocked_live_controller = MagicMock()
mocked_preview_widget = MagicMock()
mocked_service_item = MagicMock()
mocked_service_item.from_service = True
mocked_service_item.unique_identifier = 42
mocked_preview_widget.current_slide_number.return_value = 1
mocked_preview_widget.slide_count.return_value = 2
mocked_live_controller.preview_widget = MagicMock()
Registry.create()
Registry().register('live_controller', mocked_live_controller)
Registry().register('service_manager', mocked_service_manager)
slide_controller = SlideController(None)
slide_controller.service_item = mocked_service_item
slide_controller.preview_widget = mocked_preview_widget
slide_controller.display = mocked_display
# WHEN: on_go_live() is called
slide_controller.on_go_live()
# THEN: the service manager should have the service item and the focus set to live
mocked_service_manager.preview_live.assert_called_once_with(42, 1)
mocked_live_controller.preview_widget.setFocus.assert_called_once_with()