summaryrefslogtreecommitdiff
path: root/tests/unit/engines/test_unsplash.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2020-01-28 10:59:03 +0000
committerGitHub <noreply@github.com>2020-01-28 10:59:03 +0000
commite64ff38217a1ba49afd4bb1c595121d94cbb2e33 (patch)
treed8461b0392143da9d8ec9ae598b8a12c50914104 /tests/unit/engines/test_unsplash.py
parent0e7b6c9a032d67bf5cbdcfc062d8466c18a62abd (diff)
parentbda189565589b0065152f5a9fba4565404f9bd9a (diff)
downloadsearxng-e64ff38217a1ba49afd4bb1c595121d94cbb2e33.tar.gz
searxng-e64ff38217a1ba49afd4bb1c595121d94cbb2e33.zip
Merge branch 'master' into fix-infinite-scroll
Diffstat (limited to 'tests/unit/engines/test_unsplash.py')
-rw-r--r--tests/unit/engines/test_unsplash.py38
1 files changed, 0 insertions, 38 deletions
diff --git a/tests/unit/engines/test_unsplash.py b/tests/unit/engines/test_unsplash.py
deleted file mode 100644
index 4501de906..000000000
--- a/tests/unit/engines/test_unsplash.py
+++ /dev/null
@@ -1,38 +0,0 @@
-from collections import defaultdict
-import mock
-from searx.testing import SearxTestCase
-from searx.engines import unsplash
-
-
-class TestUnsplashEngine(SearxTestCase):
- def test_request(self):
- query = 'penguin'
- _dict = defaultdict(dict)
- _dict['pageno'] = 1
- params = unsplash.request(query, _dict)
-
- self.assertTrue('url' in params)
- self.assertTrue(query in params['url'])
-
- def test_response(self):
- resp = mock.Mock(text='{}')
- result = unsplash.response(resp)
- self.assertEqual([], result)
-
- resp.text = '{"results": []}'
- result = unsplash.response(resp)
- self.assertEqual([], result)
-
- # Sourced from https://unsplash.com/napi/search/photos?query=penguin&xp=&per_page=20&page=2
- with open('./tests/unit/engines/unsplash_fixture.json') as fixture:
- resp.text = fixture.read()
-
- result = unsplash.response(resp)
- self.assertEqual(len(result), 2)
- self.assertEqual(result[0]['title'], 'low angle photography of swimming penguin')
- self.assertEqual(result[0]['url'], 'https://unsplash.com/photos/FY8d721UO_4')
- self.assertEqual(result[0]['thumbnail_src'], 'https://images.unsplash.com/photo-1523557148507-1b77641c7e7c?ixlib=rb-0.3.5&q=80\
-&fm=jpg&crop=entropy&cs=tinysrgb&w=200&fit=max')
- self.assertEqual(result[0]['img_src'], 'https://images.unsplash.com/photo-1523557148507-1b77641c7e7c\
-?ixlib=rb-0.3.5')
- self.assertEqual(result[0]['content'], '')