Пример #1
0
    def test_expected_output(self):
        if self.expected_output is None:
            raise AssertionError('expected_output is not defined')

        # Create the xml
        tree = self.get_xml()
        meta_data = self.get_meta_data()

        # Verify the final output.
        html = create_html(tree, meta_data)

        assert_html_equal(html, self.expected_output)
Пример #2
0
    def test_missing_size(self, patched_item):
        def side_effect(*args, **kwargs):
            return (6, 6)
        patched_item.side_effect = side_effect
        tree = self.get_xml()
        meta_data = copy(self.get_meta_data())
        del meta_data.image_sizes['rId1']

        html = create_html(tree, meta_data)

        # Show that the height and width were grabbed from the actual image.
        assert_html_equal(html, '''
            <html>
                <p>
                    <img src="media/image1.jpeg" height="4" width="4" />
                </p>
                <p>
                    <img src="media/image2.jpeg" height="6" width="6" />
                </p>
            </html>
        ''')
Пример #3
0
    def test_missing_size(self, patched_item):
        def side_effect(*args, **kwargs):
            return (6, 6)

        patched_item.side_effect = side_effect
        tree = self.get_xml()
        meta_data = copy(self.get_meta_data())
        del meta_data.image_sizes['rId1']

        html = create_html(tree, meta_data)

        # Show that the height and width were grabbed from the actual image.
        assert_html_equal(
            html, '''
            <html>
                <p>
                    <img src="media/image1.jpeg" height="4" width="4" />
                </p>
                <p>
                    <img src="media/image2.jpeg" height="6" width="6" />
                </p>
            </html>
        ''')