-- https://www.gutenberg.org/ebooks.opds/ local navigation_sample = [[ http://www.gutenberg.org/ebooks.opds/ 2021-04-02T13:27:36Z Project Gutenberg Free ebooks since 1971. Project Gutenberg https://www.gutenberg.org webmaster@gutenberg.org https://www.gutenberg.org/gutenberg/favicon.ico 25 1 2021-04-02T13:27:36Z https://www.gutenberg.org/ebooks/search.opds/?sort_order=downloads Popular Our most popular books. 2021-04-02T13:27:36Z https://www.gutenberg.org/ebooks/search.opds/?sort_order=release_date Latest Our latest releases. 2021-04-02T13:27:36Z https://www.gutenberg.org/ebooks/search.opds/?sort_order=random Random Random books. ]] -- https://www.gutenberg.org/ebooks/42474.opds local acquisition_sample = [[ http://www.gutenberg.org/ebooks/42474.opds 2021-04-02T13:29:52Z 1000 Mythological Characters Briefly Described by Edward Sylvester Ellis Free ebooks since 1971. Project Gutenberg https://www.gutenberg.org webmaster@gutenberg.org https://www.gutenberg.org/gutenberg/favicon.ico 25 1 2021-04-02T13:29:52Z 1000 Mythological Characters Briefly Described

This edition had all images removed.

LoC No.: 00001011

Title: 1000 Mythological Characters Briefly Described
Adapted to Private Schools, High Schools and Academies

Alternate Title: One Thousand Mythological Characters Briefly Described
Adapted to Private Schools, High Schools and Academies

Author: Ellis, Edward Sylvester, 1840-1916

Ebook No.: 42474

Published: 7 apr. 2013

Downloads: 401

Language: English

Subject: Mythology -- Dictionaries

LoCC: Philosophy, Psychology, Religion: Religion: General, Miscellaneous and Atheism

Category: Text

Rights: Public domain in the USA.

urn:gutenberg:42474:2 2013-04-07T00:00:00+00:00 Public domain in the USA. Ellis, Edward Sylvester en urn:lccn:00001011 1
2021-04-02T13:29:52Z 1000 Mythological Characters Briefly Described

This edition has images.

LoC No.: 00001011

Title: 1000 Mythological Characters Briefly Described
Adapted to Private Schools, High Schools and Academies

Alternate Title: One Thousand Mythological Characters Briefly Described
Adapted to Private Schools, High Schools and Academies

Author: Ellis, Edward Sylvester, 1840-1916

Ebook No.: 42474

Published: 7 apr. 2013

Downloads: 401

Language: Engels

Subject: Mythology -- Dictionaries

LoCC: Philosophy, Psychology, Religion: Religion: General, Miscellaneous and Atheism

Category: Text

Rights: Public domain in the USA.

urn:gutenberg:42474:3 2013-04-07T00:00:00+00:00 Public domain in the USA. Ellis, Edward Sylvester en urn:lccn:00001011 1
]] local popular_new_sample = [[ http://www.feedbooks.com/publicdomain/catalog.atom Public Domain Books 2014-11-30T17:54:01Z http://assets3.feedbooks.net/images/favicon.ico?t=1417192326 Feedbooks http://www.feedbooks.com support@feedbooks.zendesk.com Most Popular 2014-11-30T17:54:01Z http://www.feedbooks.com/books/top.atom Based on last week's downloads Recently Added 2014-11-30T17:54:01Z http://www.feedbooks.com/books/recent.atom Find the latest books available Fiction 2014-11-30T17:54:01Z http://www.feedbooks.com/books/categories.atom Browse book by category Non-Fiction 2014-11-30T17:54:01Z http://www.feedbooks.com/books/categories.atom Browse book by category ]] local facet_sample = [[ tag:root:authors:Санд Книги по авторам 2014-11-30T17:27:27+01:00 /favicon.ico 2014-11-30T17:27:27+01:00 tag:author:75357 Санд Жаклин 6 книг ]] describe("OPDS module #nocov", function() local socketutil local OPDSParser, OPDSBrowser local orig_path, orig_lbt, orig_ltt, orig_fbt, orig_ftt setup(function() orig_path = package.path package.path = "plugins/opds.koplugin/?.lua;" .. package.path require("commonrequire") socketutil = require("socketutil") OPDSParser = require("opdsparser") OPDSBrowser = require("opdsbrowser") -- Make the timeouts more lenient to avoid spurious test failures orig_lbt = socketutil.LARGE_BLOCK_TIMEOUT socketutil.LARGE_BLOCK_TIMEOUT = socketutil.DEFAULT_BLOCK_TIMEOUT orig_ltt = socketutil.LARGE_TOTAL_TIMEOUT socketutil.LARGE_TOTAL_TIMEOUT = socketutil.DEFAULT_TOTAL_TIMEOUT orig_fbt = socketutil.FILE_BLOCK_TIMEOUT socketutil.FILE_BLOCK_TIMEOUT = socketutil.DEFAULT_BLOCK_TIMEOUT orig_ftt = socketutil.FILE_TOTAL_TIMEOUT socketutil.FILE_TOTAL_TIMEOUT = socketutil.DEFAULT_TOTAL_TIMEOUT end) teardown(function() package.path = orig_path socketutil.LARGE_BLOCK_TIMEOUT = orig_lbt socketutil.LARGE_TOTAL_TIMEOUT = orig_ltt socketutil.FILE_BLOCK_TIMEOUT = orig_fbt socketutil.FILE_TOTAL_TIMEOUT = orig_ftt end) describe("OPDS parser module", function() it("should parse OPDS navigation catalog", function() local catalog = OPDSParser:parse(navigation_sample) local feed = catalog.feed assert.truthy(feed) assert.are.same(feed.title, "Project Gutenberg") local entries = feed.entry assert.truthy(entries) assert.are.same(#entries, 3) local entry = entries[3] assert.are.same(entry.title, "Random") assert.are.same(entry.id, "https://www.gutenberg.org/ebooks/search.opds/?sort_order=random") assert.are.same( "/ebooks/search.opds/?sort_order=random", entry.link[1].href) end) it("should parse OPDS acquisition catalog", function() local catalog = OPDSParser:parse(acquisition_sample) local feed = catalog.feed assert.truthy(feed) local entries = feed.entry assert.truthy(entries) assert.are.same(#entries, 2) local entry = entries[2] assert.are.same(entry.title, "1000 Mythological Characters Briefly Described") assert.are.same(entry.link[1].href, "https://www.gutenberg.org/ebooks/42474.epub.images") assert.are.same(entry.link[1].title, "EPUB (with images)") end) end) describe("OPDS browser module", function() describe("URL generation", function() it("should generate search item #internet", function() local catalog = OPDSParser:parse(navigation_sample) local item_table = OPDSBrowser:genItemTableFromCatalog(catalog, "https://www.gutenberg.org/ebooks.opds/?format=opds") assert.truthy(item_table) assert.are.same(item_table[1].text, "\u{f002} " .. "Search") end) it("should generate URL on rel=subsection #internet", function() local catalog = OPDSParser:parse(navigation_sample) local item_table = OPDSBrowser:genItemTableFromCatalog(catalog, "https://www.gutenberg.org/ebooks.opds/?format=opds") assert.truthy(item_table) assert.are.same(item_table[2].title, "Popular") assert.are.same(item_table[2].url, "https://www.gutenberg.org/ebooks/search.opds/?sort_order=downloads") end) it("should generate URL on rel=popular and rel=new #internet", function() local catalog = OPDSParser:parse(popular_new_sample) local item_table = OPDSBrowser:genItemTableFromCatalog(catalog, "http://www.feedbooks.com/publicdomain/catalog.atom") assert.truthy(item_table) assert.are.same(item_table[2].title, "Most Popular") assert.are.same(item_table[2].url, "http://www.feedbooks.com/books/top.atom") assert.are.same(item_table[3].title, "Recently Added") assert.are.same(item_table[3].url, "http://www.feedbooks.com/books/recent.atom") end) it("should use the main URL for faceted links as long as faceted links aren't properly supported #internet", function() local catalog = OPDSParser:parse(facet_sample) local item_table = OPDSBrowser:genItemTableFromCatalog(catalog, "http://flibusta.is/opds") assert.truthy(item_table) assert.are.same(item_table[2].url, "http://flibusta.is/opds/author/75357") end) end) it("should not fill item table incorrectly with thumbnail or image URL #internet", function() local catalog = OPDSParser:parse(facet_sample) local item_table = OPDSBrowser:genItemTableFromCatalog(catalog, "http://flibusta.is/opds") assert.truthy(item_table) assert.are_not.same(item_table[2].image, "http://flibusta.is/opds/author/75357") end) end) end)