5b2dba13bffa95b3f91fae42331fedc5b624f5b7
[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 from tempfile import NamedTemporaryFile
7 from nose.tools import *
8 from librarian import DirDocProvider
9 from librarian.parser import WLDocument
10 from utils import get_fixture
11
12
13 def test_transform():
14     temp = NamedTemporaryFile(delete=False)
15     temp.close()
16     WLDocument.from_file(
17             get_fixture('text', 'asnyk_zbior.xml'),
18             provider=DirDocProvider(get_fixture('text', ''))
19         ).as_pdf(save_tex=temp.name)
20     tex = open(temp.name).read().decode('utf-8')
21     print tex
22
23     # Check contributor list.
24     editors = re.search(ur'\\def\\editors\{Opracowanie redakcyjne i przypisy: ([^}]*?)\.\s*\}', tex)
25     assert_equal(editors.group(1), u"Adam Fikcyjny, Aleksandra Sekuła, Olga Sutkowska")