summaryrefslogtreecommitdiffstatshomepage
path: root/tests/plugins
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/plugins/scrapers/test_ehentai_api.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/plugins/scrapers/test_ehentai_api.py b/tests/plugins/scrapers/test_ehentai_api.py
index dd283e1..c746440 100644
--- a/tests/plugins/scrapers/test_ehentai_api.py
+++ b/tests/plugins/scrapers/test_ehentai_api.py
@@ -124,6 +124,22 @@ def test_raises_scrape_error_with_invalid_json(requests_mock, gen_comic):
assert set(scraper.collect()) == set()
+def test_raises_scrape_error_with_missing_field(requests_mock, gen_comic):
+ comic = next(gen_comic)
+ comic.url = "https://exhentai.org/g/1025913/fdaabef1a2"
+
+ scraper = ehentai_api.EHentaiAPIScraper(comic)
+
+ requests_mock.post(ehentai_api.API_URL, text="{}")
+
+ assert scraper.is_available
+ assert scraper.id == 1025913
+ assert scraper.token == "fdaabef1a2"
+
+ with pytest.raises(ScrapeError, match="Response is missing 'gmetadata' field"):
+ assert set(scraper.collect()) == set()
+
+
def test_raises_scrape_error_with_error_code(requests_mock, gen_comic):
comic = next(gen_comic)
comic.url = "https://exhentai.org/g/1025913/fdaabef1a2"