summaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorFrank de Lange <github-f@unternet.org>2019-07-27 08:22:02 +0200
committerAlexandre Flament <alex@al-f.net>2019-07-27 08:22:02 +0200
commit11fc9913e9dfe170d07d8d17e0202282e3f92d6f (patch)
tree445437838139dfa2fdabe9d0c7c52eed10b4575b /tests/unit
parentf34b5cedb11bcb38eb2ad76cc3ed2b5eb421a75a (diff)
downloadsearxng-11fc9913e9dfe170d07d8d17e0202282e3f92d6f.tar.gz
searxng-11fc9913e9dfe170d07d8d17e0202282e3f92d6f.zip
[enh] bing_images: use data from embedded JSON to improve results (e.g. real page title) (#1568)
use data from embedded JSON to improve results (e.g. real page title), add image format and source info (see PR #1567), improve paging logic (it now works)
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/engines/test_bing_images.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/unit/engines/test_bing_images.py b/tests/unit/engines/test_bing_images.py
index e65e6cc04..a4efcab58 100644
--- a/tests/unit/engines/test_bing_images.py
+++ b/tests/unit/engines/test_bing_images.py
@@ -53,17 +53,25 @@ class TestBingImagesEngine(SearxTestCase):
<li>
<div>
<div class="imgpt">
- <a m='{"purl":"page_url","murl":"img_url","turl":"thumb_url"}'>
+ <a m='{"purl":"page_url","murl":"img_url","turl":"thumb_url","t":"Page 1 title"}'>
<img src="" alt="alt text" />
</a>
+ <div class="img_info">
+ <span>1 x 1 - jpeg</span>
+ <a>1.example.org</a>
+ </div>
</div>
<div></div>
</div>
<div>
<div class="imgpt">
- <a m='{"purl":"page_url2","murl":"img_url2","turl":"thumb_url2"}'>
+ <a m='{"purl":"page_url2","murl":"img_url2","turl":"thumb_url2","t":"Page 2 title"}'>
<img src="" alt="alt text 2" />
</a>
+ <div class="img_info">
+ <span>2 x 2 - jpeg</span>
+ <a>2.example.org</a>
+ </div>
</div>
</div>
</li>
@@ -72,9 +80,13 @@ class TestBingImagesEngine(SearxTestCase):
<li>
<div>
<div class="imgpt">
- <a m='{"purl":"page_url3","murl":"img_url3","turl":"thumb_url3"}'>
+ <a m='{"purl":"page_url3","murl":"img_url3","turl":"thumb_url3","t":"Page 3 title"}'>
<img src="" alt="alt text 3" />
</a>
+ <div class="img_info">
+ <span>3 x 3 - jpeg</span>
+ <a>3.example.org</a>
+ </div>
</div>
</div>
</li>
@@ -86,11 +98,13 @@ class TestBingImagesEngine(SearxTestCase):
results = bing_images.response(response)
self.assertEqual(type(results), list)
self.assertEqual(len(results), 3)
- self.assertEqual(results[0]['title'], 'alt text')
+ self.assertEqual(results[0]['title'], 'Page 1 title')
self.assertEqual(results[0]['url'], 'page_url')
self.assertEqual(results[0]['content'], '')
self.assertEqual(results[0]['thumbnail_src'], 'thumb_url')
self.assertEqual(results[0]['img_src'], 'img_url')
+ self.assertEqual(results[0]['img_format'], '1 x 1 - jpeg')
+ self.assertEqual(results[0]['source'], '1.example.org')
def test_fetch_supported_languages(self):
html = """