Beispiel #1
0
    def test_chapters(self):
        obj = book.Book(self.epub_file)
        self.assertEquals(len(obj.chapters), 6)

        for chapter in obj.chapters:
            self.assertIsNotNone(chapter)
            self.assertIsInstance(chapter, book.BookChapter)
Beispiel #2
0
 def test_metadata_contributors(self):
     name = 'Johnson Cave'
     role = 'oth'
     file_as = 'Cave, Johnson'
     self.epub_file.opf.metadata.add_contributor(name, role, file_as)
     obj = book.Book(self.epub_file)
     self.assertIn((name, role, file_as), obj.contributors)
Beispiel #3
0
 def test_metadata_publisher(self):
     publisher = 'TEST_PUBLISHER'
     self.epub_file.opf.metadata.publisher = publisher
     obj = book.Book(self.epub_file)
     self.assertEquals(obj.publisher, publisher)
Beispiel #4
0
 def test_metadata_isbn(self):
     isbn = '7814-54654-4354-43545'
     self.epub_file.opf.metadata.add_identifier(isbn, 'ID_ISBN', 'isbn')
     obj = book.Book(self.epub_file)
     self.assertEquals(obj.isbn, isbn)
Beispiel #5
0
 def test_metadata_description(self):
     description = self.epub_file.opf.metadata.description
     obj = book.Book(self.epub_file)
     self.assertEquals(obj.description, description)
Beispiel #6
0
 def test_extra_chapters(self):
     obj = book.Book(self.epub_file)
     self.assertEquals(len(list(obj.extra_chapters)), 0)
Beispiel #7
0
 def test_source(self):
     self.epub_file.opf.metadata.source = 'test_source'
     obj = book.Book(self.epub_file)
     self.assertEquals(obj.source, 'test_source')
Beispiel #8
0
 def test_dc_format(self):
     self.epub_file.opf.metadata.format = 'test_format'
     obj = book.Book(self.epub_file)
     self.assertEquals(obj.dc_format, 'test_format')
Beispiel #9
0
 def test_subjects(self):
     title = 'New test subject'
     self.epub_file.opf.metadata.add_subject(title)
     obj = book.Book(self.epub_file)
     self.assertIn(title, obj.subjects)
Beispiel #10
0
 def test_metas(self):
     name = 'meta_name'
     content = 'meta_content'
     self.epub_file.opf.metadata.add_meta(name, content)
     obj = book.Book(self.epub_file)
     self.assertIn((name, content), obj.metas)
Beispiel #11
0
 def test_right(self):
     self.epub_file.opf.metadata.right = 'test_right'
     obj = book.Book(self.epub_file)
     self.assertEquals(obj.right, 'test_right')
Beispiel #12
0
 def test_coverage(self):
     self.epub_file.opf.metadata.coverage = 'test_coverage'
     obj = book.Book(self.epub_file)
     self.assertEquals(obj.coverage, 'test_coverage')
Beispiel #13
0
 def test_relation(self):
     self.epub_file.opf.metadata.relation = 'test_relation'
     obj = book.Book(self.epub_file)
     self.assertEquals(obj.relation, 'test_relation')
Beispiel #14
0
 def test_languages(self):
     lang = 'test_lang'
     self.epub_file.opf.metadata.add_language(lang)
     obj = book.Book(self.epub_file)
     self.assertIn(lang, obj.languages)
Beispiel #15
0
 def test_dates(self):
     date = '2032-08-04'
     event = 'publication'
     self.epub_file.opf.metadata.add_date(date, event)
     obj = book.Book(self.epub_file)
     self.assertIn((date, event), obj.dates)
Beispiel #16
0
 def test_dc_type(self):
     self.epub_file.opf.metadata.dc_type = 'test_type'
     obj = book.Book(self.epub_file)
     self.assertEquals(obj.dc_type, 'test_type')
Beispiel #17
0
 def test_titles(self):
     title = 'New test title'
     lang = 'fra_alt'
     self.epub_file.opf.metadata.add_title(title, lang)
     obj = book.Book(self.epub_file)
     self.assertIn((title, lang), obj.titles)
Beispiel #18
0
 def test_identifiers(self):
     obj = book.Book(self.epub_file)
     self.assertEquals(obj.identifiers, [
         ('urn:uuid:477d1a82-a70d-4ee5-a0ff-0dddc60fd2bb', 'BookId', 'UUID')
     ])
Beispiel #19
0
 def setUp(self):
     self.epub_file = content.open_epub(self.epub_path)
     self.book = book.Book(self.epub_file)