本文整理汇总了Python中tests.functional.MagicMock.plugins方法的典型用法代码示例。如果您正苦于以下问题:Python MagicMock.plugins方法的具体用法?Python MagicMock.plugins怎么用?Python MagicMock.plugins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.functional.MagicMock
的用法示例。
在下文中一共展示了MagicMock.plugins方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: css_changed_test
# 需要导入模块: from tests.functional import MagicMock [as 别名]
# 或者: from tests.functional.MagicMock import plugins [as 别名]
def css_changed_test(self):
"""
Test that when the CSS changes, the plugins are looped over and given an opportunity to update the CSS
"""
# GIVEN: A mocked list of plugins, a mocked display and a MainDisplay
mocked_songs_plugin = MagicMock()
mocked_bibles_plugin = MagicMock()
mocked_plugin_manager = MagicMock()
mocked_plugin_manager.plugins = [mocked_songs_plugin, mocked_bibles_plugin]
Registry().register('plugin_manager', mocked_plugin_manager)
display = MagicMock()
main_display = MainDisplay(display)
# This is set up dynamically, so we need to mock it out for now
main_display.frame = MagicMock()
# WHEN: The css_changed() method is triggered
main_display.css_changed()
# THEN: The plugins should have each been given an opportunity to add their bit to the CSS
mocked_songs_plugin.refresh_css.assert_called_with(main_display.frame)
mocked_bibles_plugin.refresh_css.assert_called_with(main_display.frame)