From 8fb6ae715b9c23ed8970b6d113f59b69b308104f Mon Sep 17 00:00:00 2001 From: Steady Quad Date: Fri, 2 Apr 2021 18:50:26 +0200 Subject: [PATCH] =?UTF-8?q?Update=20tests=20in=20opds=5Fspec=20for=20Guten?= =?UTF-8?q?berg=20http=20=E2=86=92=20https=20(#7489)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See #7439 --- spec/unit/opds_spec.lua | 128 +++++++++++++++++++++++++--------------- 1 file changed, 80 insertions(+), 48 deletions(-) diff --git a/spec/unit/opds_spec.lua b/spec/unit/opds_spec.lua index dba464642..08bc95128 100644 --- a/spec/unit/opds_spec.lua +++ b/spec/unit/opds_spec.lua @@ -1,3 +1,4 @@ +-- https://www.gutenberg.org/ebooks.opds/ local navigation_sample = [[ -http://m.gutenberg.org/ebooks.opds/ -2014-05-17T12:04:49Z +--> +http://www.gutenberg.org/ebooks.opds/ +2021-04-02T13:27:36Z Project Gutenberg Free ebooks since 1971. -Marcello Perathoner -http://www.gutenberg.org +Project Gutenberg +https://www.gutenberg.org webmaster@gutenberg.org -http://m.gutenberg.org/pics/favicon.png - +https://www.gutenberg.org/gutenberg/favicon.ico + 25 1 -2014-05-17T12:04:49Z -http://m.gutenberg.org/ebooks/search.opds/?sort_order=downloads +2021-04-02T13:27:36Z +https://www.gutenberg.org/ebooks/search.opds/?sort_order=downloads Popular Our most popular books. -2014-05-17T12:04:49Z -http://m.gutenberg.org/ebooks/search.opds/?sort_order=release_date +2021-04-02T13:27:36Z +https://www.gutenberg.org/ebooks/search.opds/?sort_order=release_date Latest Our latest releases. -2014-05-17T12:04:49Z -http://m.gutenberg.org/ebooks/search.opds/?sort_order=random +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://m.gutenberg.org:80/ebooks/42474.opds -2014-09-03T12:16:15Z +--> +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. -Marcello Perathoner -http://www.gutenberg.org +Project Gutenberg +https://www.gutenberg.org webmaster@gutenberg.org -http://m.gutenberg.org:80/pics/favicon.png - +https://www.gutenberg.org/gutenberg/favicon.ico + 25 1 -2014-09-03T12:16:15Z +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: Apr 7, 2013

-

Downloads: 1209

+

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.

@@ -106,31 +119,46 @@ Title: Ellis, Edward Sylvester + + en +urn:lccn:00001011 1 - - - - - - + + + + + + +
-2014-09-03T12:16:15Z +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: Apr 7, 2013

-

Downloads: 1209

-

Language: English

+

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.

@@ -141,15 +169,19 @@ Title: Ellis, Edward Sylvester + + en +urn:lccn:00001011 1 - - - - - - + + + + + + +
]] @@ -253,9 +285,9 @@ describe("OPDS module #nocov", function() assert.are.same(#entries, 3) local entry = entries[3] assert.are.same(entry.title, "Random") - assert.are.same(entry.id, "http://m.gutenberg.org/ebooks/search.opds/?sort_order=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&limit=5", + "/ebooks/search.opds/?sort_order=random", entry.link[1].href) end) it("should parse OPDS acquisition catalog", function() @@ -267,7 +299,7 @@ describe("OPDS module #nocov", function() 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, "//www.gutenberg.org/ebooks/42474.epub.images") + assert.are.same(entry.link[1].href, "https://www.gutenberg.org/ebooks/42474.epub.images") end) end) @@ -275,18 +307,18 @@ describe("OPDS module #nocov", function() describe("URL generation", function() it("should generate search item", function() local catalog = OPDSParser:parse(navigation_sample) - local item_table = OPDSBrowser:genItemTableFromCatalog(catalog, "http://m.gutenberg.org/ebooks.opds/?format=opds") + 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, "Search") end) it("should generate URL on rel=subsection", function() local catalog = OPDSParser:parse(navigation_sample) - local item_table = OPDSBrowser:genItemTableFromCatalog(catalog, "http://m.gutenberg.org/ebooks.opds/?format=opds") + 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, "http://m.gutenberg.org/ebooks/search.opds/?sort_order=downloads") + 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", function() local catalog = OPDSParser:parse(popular_new_sample)