Example #1
0
 def test_get_image_urls(self):
     test_url_1 = 'http://example.com'
     test_chapter_1 = chapter.create_chapter_from_url(test_url_1)
     self.assertEqual(test_chapter_1._get_image_urls(), [])
     test_url_2 = 'http://williamcember.com'
     test_chapter_2 = chapter.create_chapter_from_url(test_url_2)
     test_image_list_2 = self.test_image_list
     image_url_list_2_calced = [t[1] for t in test_chapter_2._get_image_urls()]
     self.assertEqual(image_url_list_2_calced, test_image_list_2)
Example #2
0
 def test_get_image_urls(self):
     test_url_1 = 'http://example.com'
     test_chapter_1 = chapter.create_chapter_from_url(test_url_1)
     self.assertEqual(test_chapter_1._get_image_urls(), [])
     test_url_2 = 'http://williamcember.com'
     test_chapter_2 = chapter.create_chapter_from_url(test_url_2)
     test_image_list_2 = self.test_image_list
     image_url_list_2_calced = [t[1] for t in test_chapter_2._get_image_urls()]
     self.assertEqual(image_url_list_2_calced, test_image_list_2)
Example #3
0
 def test_replace_image(self):
     test_url = 'http://williamcember.com'
     test_ebook_dir = os.path.join(test_directory, 'epub_output')
     c = chapter.create_chapter_from_url(test_url)
     c._replace_images_in_chapter(test_ebook_dir)
     c.write(os.path.join(test_directory, 'test_cember.xhtml'))
Example #4
0
 def test_replace_image(self):
     test_url = 'http://williamcember.com'
     test_ebook_dir = os.path.join(test_directory, 'epub_output')
     c = chapter.create_chapter_from_url(test_url)
     c._replace_images_in_chapter(test_ebook_dir)
     c.write(os.path.join(test_directory, 'test_cember.xhtml'))
Example #5
0
def create_test_epub():
    my_first_epub = epub.Epub('My First Epub')
    my_first_chapter = chapter.create_chapter_from_url(
        'https://en.wikipedia.org/wiki/Grand_Teton_National_Park')
    my_first_epub.add_chapter(my_first_chapter)
    my_first_epub.create_epub(os.path.join(TEST_DIR, 'epub_output'))
Example #6
0
def create_test_epub():
    my_first_epub = epub.Epub('My First Epub')
    my_first_chapter = chapter.create_chapter_from_url('https://en.wikipedia.org/wiki/Grand_Teton_National_Park')
    my_first_epub.add_chapter(my_first_chapter)
    my_first_epub.create_epub(os.path.join(TEST_DIR, 'epub_output'))