forked from Ponysearch/Ponysearch
[fix] tests ++ flickr error
This commit is contained in:
parent
ef2ef7974a
commit
fdf63940e8
7 changed files with 10 additions and 13 deletions
|
@ -82,7 +82,7 @@ def response(resp):
|
||||||
'title': photo['title'],
|
'title': photo['title'],
|
||||||
'img_src': img_src,
|
'img_src': img_src,
|
||||||
'thumbnail_src': thumbnail_src,
|
'thumbnail_src': thumbnail_src,
|
||||||
'content': content = photo['description']['_content'],
|
'content': photo['description']['_content'],
|
||||||
'author': photo['ownername'],
|
'author': photo['ownername'],
|
||||||
'template': 'images.html'})
|
'template': 'images.html'})
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ class TestDeezerEngine(SearxTestCase):
|
||||||
self.assertEqual(len(results), 1)
|
self.assertEqual(len(results), 1)
|
||||||
self.assertEqual(results[0]['title'], 'Title of track')
|
self.assertEqual(results[0]['title'], 'Title of track')
|
||||||
self.assertEqual(results[0]['url'], 'https://www.deezer.com/track/1094042')
|
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'])
|
self.assertTrue('100' in results[0]['embedded'])
|
||||||
|
|
||||||
json = r"""
|
json = r"""
|
||||||
|
|
|
@ -52,7 +52,7 @@ class TestFlickrEngine(SearxTestCase):
|
||||||
self.assertEqual(results[0]['url'], 'https://www.flickr.com/photos/66847915@N08/15751017054')
|
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]['img_src'])
|
||||||
self.assertTrue('n.jpg' in results[0]['thumbnail_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'])
|
self.assertTrue('Description' in results[0]['content'])
|
||||||
|
|
||||||
json = r"""
|
json = r"""
|
||||||
|
@ -76,7 +76,7 @@ class TestFlickrEngine(SearxTestCase):
|
||||||
self.assertEqual(results[0]['url'], 'https://www.flickr.com/photos/66847915@N08/15751017054')
|
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]['img_src'])
|
||||||
self.assertTrue('z.jpg' in results[0]['thumbnail_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'])
|
self.assertTrue('Description' in results[0]['content'])
|
||||||
|
|
||||||
json = r"""
|
json = r"""
|
||||||
|
@ -100,7 +100,7 @@ class TestFlickrEngine(SearxTestCase):
|
||||||
self.assertEqual(results[0]['url'], 'https://www.flickr.com/photos/66847915@N08/15751017054')
|
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]['img_src'])
|
||||||
self.assertTrue('o.jpg' in results[0]['thumbnail_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'])
|
self.assertTrue('Description' in results[0]['content'])
|
||||||
|
|
||||||
json = r"""
|
json = r"""
|
||||||
|
|
|
@ -145,7 +145,7 @@ class TestFlickrNoapiEngine(SearxTestCase):
|
||||||
self.assertEqual(results[0]['url'], 'https://www.flickr.com/photos/59729010@N00/14001294434')
|
self.assertEqual(results[0]['url'], 'https://www.flickr.com/photos/59729010@N00/14001294434')
|
||||||
self.assertIn('k.jpg', results[0]['img_src'])
|
self.assertIn('k.jpg', results[0]['img_src'])
|
||||||
self.assertIn('n.jpg', results[0]['thumbnail_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
|
# no n size, only the z size
|
||||||
json = """
|
json = """
|
||||||
|
@ -188,7 +188,7 @@ class TestFlickrNoapiEngine(SearxTestCase):
|
||||||
self.assertEqual(results[0]['url'], 'https://www.flickr.com/photos/59729010@N00/14001294434')
|
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]['img_src'])
|
||||||
self.assertIn('z.jpg', results[0]['thumbnail_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
|
# no z or n size
|
||||||
json = """
|
json = """
|
||||||
|
@ -231,7 +231,7 @@ class TestFlickrNoapiEngine(SearxTestCase):
|
||||||
self.assertEqual(results[0]['url'], 'https://www.flickr.com/photos/59729010@N00/14001294434')
|
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]['img_src'])
|
||||||
self.assertIn('o.jpg', results[0]['thumbnail_src'])
|
self.assertIn('o.jpg', results[0]['thumbnail_src'])
|
||||||
self.assertIn('Owner', results[0]['content'])
|
self.assertIn('Owner', results[0]['author'])
|
||||||
|
|
||||||
# no image test
|
# no image test
|
||||||
json = """
|
json = """
|
||||||
|
|
|
@ -98,7 +98,7 @@ class TestKickassEngine(SearxTestCase):
|
||||||
self.assertEqual(len(results), 1)
|
self.assertEqual(len(results), 1)
|
||||||
self.assertEqual(results[0]['title'], 'This should be the title')
|
self.assertEqual(results[0]['title'], 'This should be the title')
|
||||||
self.assertEqual(results[0]['url'], 'https://kickass.cd/url.html')
|
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]['seed'], 10)
|
||||||
self.assertEqual(results[0]['leech'], 1)
|
self.assertEqual(results[0]['leech'], 1)
|
||||||
self.assertEqual(results[0]['filesize'], 449)
|
self.assertEqual(results[0]['filesize'], 449)
|
||||||
|
|
|
@ -56,9 +56,6 @@ class TestSearchcodeDocEngine(SearxTestCase):
|
||||||
self.assertEqual(len(results), 1)
|
self.assertEqual(len(results), 1)
|
||||||
self.assertEqual(results[0]['title'], '[Type] Namespace test')
|
self.assertEqual(results[0]['title'], '[Type] Namespace test')
|
||||||
self.assertEqual(results[0]['url'], 'http://url')
|
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'])
|
self.assertIn('Description', results[0]['content'])
|
||||||
|
|
||||||
json = r"""
|
json = r"""
|
||||||
|
|
|
@ -90,7 +90,7 @@ class TestSpotifyEngine(SearxTestCase):
|
||||||
self.assertEqual(len(results), 1)
|
self.assertEqual(len(results), 1)
|
||||||
self.assertEqual(results[0]['title'], 'Title of track')
|
self.assertEqual(results[0]['title'], 'Title of track')
|
||||||
self.assertEqual(results[0]['url'], 'https://open.spotify.com/track/2GzvFiedqW8hgqUpWcASZa')
|
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'])
|
self.assertIn('1000', results[0]['embedded'])
|
||||||
|
|
||||||
json = """
|
json = """
|
||||||
|
|
Loading…
Reference in a new issue