-def test_transform():
- epub_file = WLDocument.from_file(
- get_fixture('text', 'asnyk_zbior.xml'),
- provider=DirDocProvider(get_fixture('text', ''))
- ).as_epub(cover=True, flags=['without_fonts'])
- zipf = ZipFile(epub_file.get_file())
-
- # Check contributor list.
- last = zipf.open('EPUB/last.xhtml')
- tree = html.parse(last)
- editors_attribution = False
- for par in tree.findall("//p"):
- if par.text.startswith(u'Opracowanie redakcyjne i przypisy:'):
- editors_attribution = True
- assert_equal(
- par.text.rstrip(),
- u'Opracowanie redakcyjne i przypisy: '
- u'Adam Fikcyjny, Aleksandra Sekuła, Olga Sutkowska.')
- assert_true(editors_attribution)
-
- # Check that we have a valid EPUB.
- assert_equal(
- subprocess.call([
- 'epubcheck', '-quiet', epub_file.get_filename()
- ]),
- 0
- )
+class EpubTests(unittest.TestCase):
+ def test_transform(self):
+ epub_file = EpubBuilder().build(
+ WLDocument(
+ get_fixture('text', 'asnyk_zbior.xml'),
+ provider=DirDocProvider(get_fixture('text', ''))
+ )
+ )
+ zipf = ZipFile(epub_file.get_file())