Fix HTML test.
[librarian.git] / tests / test_pdf.py
1 # -*- coding: utf-8 -*-
2 #
3 # This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
4 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 #
6 import re
7 from tempfile import NamedTemporaryFile
8 from nose.tools import *
9 from librarian import DirDocProvider
10 from librarian.parser import WLDocument
11 from utils import get_fixture
12
13
14 def test_transform():
15     temp = NamedTemporaryFile(delete=False)
16     temp.close()
17     WLDocument.from_file(
18             get_fixture('text', 'asnyk_zbior.xml'),
19             provider=DirDocProvider(get_fixture('text', ''))
20         ).as_pdf(save_tex=temp.name)
21     tex = open(temp.name).read().decode('utf-8')
22     print tex
23
24     # Check contributor list.
25     editors = re.search(ur'\\def\\editors\{'
26         ur'Opracowanie redakcyjne i przypisy: ([^}]*?)\.\s*\}', tex)
27     assert_equal(editors.group(1),
28         u"Adam Fikcyjny, Aleksandra Sekuła, Olga Sutkowska")