Move HTML from the old transform sheet.
[librarian.git] / tests / test_html.py
1 # This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
3 #
4 import io
5 from unittest import TestCase
6 from librarian.builders import builders
7 from librarian.document import WLDocument
8 from .utils import get_fixture
9
10
11 class TransformTest(TestCase):
12     maxDiff = None
13
14     def test_transform(self):
15         expected_output_file_path = get_fixture('text', 'asnyk_miedzy_nami_expected.html')
16         html = WLDocument(
17             filename=get_fixture('text', 'miedzy-nami-nic-nie-bylo.xml')
18         ).build(builders['html']).get_bytes().decode('utf-8')
19
20         with open(expected_output_file_path) as f:
21             self.assertEqual(html, f.read())
22
23     def test_empty(self):
24         self.assertIsNone(
25             WLDocument(
26                 filename=io.BytesIO(b'<utwor />'),
27             ).build(builders['html'], base_url='/')
28         )