logo

searx

My custom branche(s) on searx, a meta-search engine
commit: fdf63940e8e576aee9fe5e03337d39e771f24514
parent: ef2ef7974ab9bf55c5193a30544f71d8ca04f7b0
Author: Adam Tauber <asciimoo@gmail.com>
Date:   Fri,  9 Dec 2016 19:10:57 +0100

[fix] tests ++ flickr error

Diffstat:

Msearx/engines/flickr.py2+-
Mtests/unit/engines/test_deezer.py2+-
Mtests/unit/engines/test_flickr.py6+++---
Mtests/unit/engines/test_flickr_noapi.py6+++---
Mtests/unit/engines/test_kickass.py2+-
Mtests/unit/engines/test_searchcode_doc.py3---
Mtests/unit/engines/test_spotify.py2+-
7 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/searx/engines/flickr.py b/searx/engines/flickr.py @@ -82,7 +82,7 @@ def response(resp): 'title': photo['title'], 'img_src': img_src, 'thumbnail_src': thumbnail_src, - 'content': content = photo['description']['_content'], + 'content': photo['description']['_content'], 'author': photo['ownername'], 'template': 'images.html'}) diff --git a/tests/unit/engines/test_deezer.py b/tests/unit/engines/test_deezer.py @@ -42,7 +42,7 @@ class TestDeezerEngine(SearxTestCase): self.assertEqual(len(results), 1) self.assertEqual(results[0]['title'], 'Title of track') self.assertEqual(results[0]['url'], 'https://www.deezer.com/track/1094042') - self.assertEqual(results[0]['content'], 'Artist Name &bull; Album Title &bull; Title of track') + self.assertEqual(results[0]['content'], 'Artist Name - Album Title - Title of track') self.assertTrue('100' in results[0]['embedded']) json = r""" diff --git a/tests/unit/engines/test_flickr.py b/tests/unit/engines/test_flickr.py @@ -52,7 +52,7 @@ class TestFlickrEngine(SearxTestCase): self.assertEqual(results[0]['url'], 'https://www.flickr.com/photos/66847915@N08/15751017054') self.assertTrue('o.jpg' in results[0]['img_src']) self.assertTrue('n.jpg' in results[0]['thumbnail_src']) - self.assertTrue('Owner' in results[0]['content']) + self.assertTrue('Owner' in results[0]['author']) self.assertTrue('Description' in results[0]['content']) json = r""" @@ -76,7 +76,7 @@ class TestFlickrEngine(SearxTestCase): self.assertEqual(results[0]['url'], 'https://www.flickr.com/photos/66847915@N08/15751017054') self.assertTrue('z.jpg' in results[0]['img_src']) self.assertTrue('z.jpg' in results[0]['thumbnail_src']) - self.assertTrue('Owner' in results[0]['content']) + self.assertTrue('Owner' in results[0]['author']) self.assertTrue('Description' in results[0]['content']) json = r""" @@ -100,7 +100,7 @@ class TestFlickrEngine(SearxTestCase): self.assertEqual(results[0]['url'], 'https://www.flickr.com/photos/66847915@N08/15751017054') self.assertTrue('o.jpg' in results[0]['img_src']) self.assertTrue('o.jpg' in results[0]['thumbnail_src']) - self.assertTrue('Owner' in results[0]['content']) + self.assertTrue('Owner' in results[0]['author']) self.assertTrue('Description' in results[0]['content']) json = r""" diff --git a/tests/unit/engines/test_flickr_noapi.py b/tests/unit/engines/test_flickr_noapi.py @@ -145,7 +145,7 @@ class TestFlickrNoapiEngine(SearxTestCase): self.assertEqual(results[0]['url'], 'https://www.flickr.com/photos/59729010@N00/14001294434') self.assertIn('k.jpg', results[0]['img_src']) self.assertIn('n.jpg', results[0]['thumbnail_src']) - self.assertIn('Owner', results[0]['content']) + self.assertIn('Owner', results[0]['author']) # no n size, only the z size json = """ @@ -188,7 +188,7 @@ class TestFlickrNoapiEngine(SearxTestCase): self.assertEqual(results[0]['url'], 'https://www.flickr.com/photos/59729010@N00/14001294434') self.assertIn('z.jpg', results[0]['img_src']) self.assertIn('z.jpg', results[0]['thumbnail_src']) - self.assertIn('Owner', results[0]['content']) + self.assertIn('Owner', results[0]['author']) # no z or n size json = """ @@ -231,7 +231,7 @@ class TestFlickrNoapiEngine(SearxTestCase): self.assertEqual(results[0]['url'], 'https://www.flickr.com/photos/59729010@N00/14001294434') self.assertIn('o.jpg', results[0]['img_src']) self.assertIn('o.jpg', results[0]['thumbnail_src']) - self.assertIn('Owner', results[0]['content']) + self.assertIn('Owner', results[0]['author']) # no image test json = """ diff --git a/tests/unit/engines/test_kickass.py b/tests/unit/engines/test_kickass.py @@ -98,7 +98,7 @@ class TestKickassEngine(SearxTestCase): self.assertEqual(len(results), 1) self.assertEqual(results[0]['title'], 'This should be the title') self.assertEqual(results[0]['url'], 'https://kickass.cd/url.html') - self.assertEqual(results[0]['content'], 'Posted by riri in Other &gt; Unsorted') + self.assertEqual(results[0]['content'], 'Posted by riri in Other > Unsorted') self.assertEqual(results[0]['seed'], 10) self.assertEqual(results[0]['leech'], 1) self.assertEqual(results[0]['filesize'], 449) diff --git a/tests/unit/engines/test_searchcode_doc.py b/tests/unit/engines/test_searchcode_doc.py @@ -56,9 +56,6 @@ class TestSearchcodeDocEngine(SearxTestCase): self.assertEqual(len(results), 1) self.assertEqual(results[0]['title'], '[Type] Namespace test') self.assertEqual(results[0]['url'], 'http://url') - self.assertIn('Synopsis', results[0]['content']) - self.assertIn('Type', results[0]['content']) - self.assertIn('test', results[0]['content']) self.assertIn('Description', results[0]['content']) json = r""" diff --git a/tests/unit/engines/test_spotify.py b/tests/unit/engines/test_spotify.py @@ -90,7 +90,7 @@ class TestSpotifyEngine(SearxTestCase): self.assertEqual(len(results), 1) self.assertEqual(results[0]['title'], 'Title of track') self.assertEqual(results[0]['url'], 'https://open.spotify.com/track/2GzvFiedqW8hgqUpWcASZa') - self.assertEqual(results[0]['content'], 'Artist Name &bull; Album Title &bull; Title of track') + self.assertEqual(results[0]['content'], 'Artist Name - Album Title - Title of track') self.assertIn('1000', results[0]['embedded']) json = """