From fdf63940e8e576aee9fe5e03337d39e771f24514 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Fri, 9 Dec 2016 19:10:57 +0100 Subject: [PATCH] [fix] tests ++ flickr error --- searx/engines/flickr.py | 2 +- tests/unit/engines/test_deezer.py | 2 +- tests/unit/engines/test_flickr.py | 6 +++--- tests/unit/engines/test_flickr_noapi.py | 6 +++--- tests/unit/engines/test_kickass.py | 2 +- tests/unit/engines/test_searchcode_doc.py | 3 --- tests/unit/engines/test_spotify.py | 2 +- 7 files changed, 10 insertions(+), 13 deletions(-) diff --git a/searx/engines/flickr.py b/searx/engines/flickr.py index 1c3eef78..5ce1160e 100644 --- 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 index cfef852a..5b9f55c3 100644 --- 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 • Album Title • 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 index 2d7472a9..be97647c 100644 --- 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 index 6d09071b..5f8b069e 100644 --- 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 index 96c17911..7e1225da 100644 --- 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 > 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 index 7228613e..d02bb7a4 100644 --- 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 index fd274abb..e37c344d 100644 --- 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 • Album Title • Title of track') + self.assertEqual(results[0]['content'], 'Artist Name - Album Title - Title of track') self.assertIn('1000', results[0]['embedded']) json = """