aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGertjan van den Burg <gertjanvandenburg@gmail.com>2020-11-11 19:36:07 +0000
committerGertjan van den Burg <gertjanvandenburg@gmail.com>2020-11-11 19:36:07 +0000
commit882805565241bf2765b632e7b89a1f733a935a45 (patch)
tree0202289c2afe912232c92fd76ce7420a753584fe /tests
parentAdd note on activating alias (diff)
downloadpaper2remarkable-882805565241bf2765b632e7b89a1f733a935a45.tar.gz
paper2remarkable-882805565241bf2765b632e7b89a1f733a935a45.zip
Add experimental fix for lazy loaded images in html
Diffstat (limited to 'tests')
-rw-r--r--tests/test_html.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_html.py b/tests/test_html.py
new file mode 100644
index 0000000..d271bb5
--- /dev/null
+++ b/tests/test_html.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""Additional tests for the HTML provider
+
+This file is part of paper2remarkable.
+
+"""
+
+import unittest
+
+from paper2remarkable.providers.html import HTML
+from paper2remarkable.providers.html import make_readable
+from paper2remarkable.utils import get_page_with_retry
+
+
+class TestHTML(unittest.TestCase):
+ def test_experimental_fix_lazy_loading(self):
+ url = "https://www.seriouseats.com/2015/01/tea-for-everyone.html"
+ prov = HTML(upload=False, experimental=True)
+ page = get_page_with_retry(url, return_text=True)
+ title, article = make_readable(page)
+ html_article = prov.preprocess_html(url, title, article)
+ expected_image = "https://www.seriouseats.com/images/2015/01/20150118-tea-max-falkowitz-3.jpg"
+ self.assertIn(expected_image, html_article)
+
+
+if __name__ == "__main__":
+ unittest.main()