+ # Check that we have a valid EPUB.
+ assert_equal(
+ subprocess.call([
+ 'epubcheck', '-quiet', epub_file.get_filename()
+ ]),
+ 0
+ )
+
+ book = epub.read_epub(epub_file.get_filename())
+
+ # Check that guide items are there.
+ assert_equals(
+ book.guide,
+ [
+ {'href': 'part1.xhtml', 'title': 'Początek', 'type': 'text'},
+ {'href': 'cover.xhtml', 'title': 'Okładka', 'type': 'cover'}
+ ]
+ )
+
+ # Check that metadata is there.
+ DC = "http://purl.org/dc/elements/1.1/"
+ OPF = "http://www.idpf.org/2007/opf"
+
+ assert_equals(
+ book.get_metadata(OPF, "cover"),
+ [(None, {'name': 'cover', 'content': 'cover-img'})]
+ )
+ assert_equals(
+ book.get_metadata(DC, "title"),
+ [('Poezye', {})]
+ )
+ assert_equals(
+ book.get_metadata(DC, "language"),
+ [('pl', {})]
+ )
+ assert_equals(
+ book.get_metadata(DC, "identifier"),
+ [('http://wolnelektury.pl/katalog/lektura/poezye', {
+ 'id': 'id',
+ })]
+ )
+ assert_equals(
+ book.get_metadata(DC, "creator"),
+ [('Adam Asnyk', {"id": "creator"})]
+ )
+ assert_equals(
+ book.get_metadata(DC, "publisher"),
+ [('Fundacja Nowoczesna Polska', {})]
+ )
+ assert_equals(
+ book.get_metadata(DC, "date"),
+ [("2007-09-06", {})]
+ )
+