diff --git a/searx/engines/www1x.py b/searx/engines/www1x.py index d10c4ca37..a68c105ce 100644 --- a/searx/engines/www1x.py +++ b/searx/engines/www1x.py @@ -36,7 +36,8 @@ def response(resp): results = [] # get links from result-text - results_parts = re.split(r'(||') + self.assertEqual(www1x.response(response), []) + html = """ + + + + + + + ] + > + + +
Photos
+
+ + + + + + +
+ + + ]]>
+ """ + response = mock.Mock(text=html) + results = www1x.response(response) + self.assertEqual(type(results), list) + self.assertEqual(len(results), 1) + self.assertEqual(results[0]['url'], 'http://1x.com/photo/123456') + self.assertEqual(results[0]['thumbnail_src'], 'http://1x.com/images/user/testimage-123456.jpg') + self.assertEqual(results[0]['content'], '') + self.assertEqual(results[0]['template'], 'images.html') diff --git a/searx/tests/test_engines.py b/searx/tests/test_engines.py index 1ffdbe529..cfd7fa26a 100644 --- a/searx/tests/test_engines.py +++ b/searx/tests/test_engines.py @@ -1,2 +1,3 @@ from searx.tests.engines.test_dummy import * # noqa from searx.tests.engines.test_github import * # noqa +from searx.tests.engines.test_www1x import * # noqa