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)