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


Python MagicMock.bg_image_bytes方法代码示例

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


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

示例1: build_html_test

# 需要导入模块: from tests.functional import MagicMock [as 别名]
# 或者: from tests.functional.MagicMock import bg_image_bytes [as 别名]
    def build_html_test(self):
        """
        Test the build_html() function
        """
        # GIVEN: Mocked arguments and function.
        with patch('openlp.core.lib.htmlbuilder.build_background_css') as mocked_build_background_css, \
                patch('openlp.core.lib.htmlbuilder.build_footer_css') as mocked_build_footer_css, \
                patch('openlp.core.lib.htmlbuilder.build_lyrics_css') as mocked_build_lyrics_css:
            # Mocked function.
            mocked_build_background_css.return_value = ''
            mocked_build_footer_css.return_value = 'dummy: dummy;'
            mocked_build_lyrics_css.return_value = ''
            # Mocked arguments.
            item = MagicMock()
            item.bg_image_bytes = None
            screen = MagicMock()
            is_live = False
            background = None
            plugin = MagicMock()
            plugin.get_display_css.return_value = 'plugin CSS'
            plugin.get_display_javascript.return_value = 'plugin JS'
            plugin.get_display_html.return_value = 'plugin HTML'
            plugins = [plugin]

            # WHEN: Create the html.
            html = build_html(item, screen, is_live, background, plugins=plugins)

            # THEN: The returned html should match.
            self.assertEqual(html, HTML, 'The returned html should match')
开发者ID:crossroadchurch,项目名称:paul,代码行数:31,代码来源:test_htmlbuilder.py


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