Exemple #1
0
 def test_invalid_epub_fails(self, invalid_epub_file):
     node = DocumentNode('doc-src-id',
                         "Document",
                         licenses.PUBLIC_DOMAIN,
                         thumbnail=None)
     node.add_file(invalid_epub_file)
     config.THUMBNAILS = True
     filenames = node.process_files()
     # assert filenames == [None], 'expected one None filename (the broken epub)'  # TODO: implement epub deep validation
     assert len(config.FAILED_FILES) == 1, 'expected one failed file'
Exemple #2
0
 def test_generate_thumbnail_from_epub(self, epub_file):
     node = DocumentNode('doc-src-id',
                         "Document",
                         licenses.PUBLIC_DOMAIN,
                         thumbnail=None)
     node.add_file(epub_file)
     config.THUMBNAILS = True
     filenames = node.process_files()
     assert len(filenames) == 2, 'expected two filenames'
     self.check_has_thumbnail(node)
Exemple #3
0
 def test_invalid_htmlzip_fails(self, html_invalid_file):
     node = DocumentNode('doc-src-id',
                         "Document",
                         licenses.PUBLIC_DOMAIN,
                         thumbnail=None)
     node.add_file(html_invalid_file)
     config.THUMBNAILS = True
     filenames = node.process_files()
     assert filenames == [None
                          ], 'expected one None filename (the broken html)'
     assert len(config.FAILED_FILES) == 1, 'expected one failed file'
Exemple #4
0
 def test_non_existent_epub_fails(self):
     node = DocumentNode('doc-src-id',
                         "Document",
                         licenses.PUBLIC_DOMAIN,
                         thumbnail=None)
     non_existent_path = 'does/not/exist.epub'
     document_file = DocumentFile(non_existent_path, language='en')
     node.add_file(document_file)
     config.THUMBNAILS = True
     filenames = node.process_files()
     assert filenames == [None], 'expected one None (the non existent epub)'
     assert len(config.FAILED_FILES) == 1, 'expected one failed file'