From a235c54f8c8442242fe727908162e5ece8739b5a Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Tue, 28 Jan 2025 20:30:07 +0100 Subject: [mod] rudimentary implementation of a MainResult type Signed-off-by: Markus Heiser --- tests/unit/test_webapp.py | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) (limited to 'tests/unit/test_webapp.py') diff --git a/tests/unit/test_webapp.py b/tests/unit/test_webapp.py index 12c86e4f0..e8f4fcdcd 100644 --- a/tests/unit/test_webapp.py +++ b/tests/unit/test_webapp.py @@ -2,13 +2,13 @@ # pylint: disable=missing-module-docstring,disable=missing-class-docstring,invalid-name import json -from urllib.parse import ParseResult import babel from mock import Mock import searx.webapp import searx.search import searx.search.processors +from searx.result_types._base import MainResult from searx.results import Timing from searx.preferences import Preferences @@ -31,30 +31,21 @@ class ViewsTestCase(SearxTestCase): # pylint: disable=too-many-public-methods # set some defaults test_results = [ - { - 'content': 'first test content', - 'title': 'First Test', - 'url': 'http://first.test.xyz', - 'engines': ['youtube', 'startpage'], - 'engine': 'startpage', - 'parsed_url': ParseResult( - scheme='http', netloc='first.test.xyz', path='/', params='', query='', fragment='' - ), - 'template': 'default.html', - }, - { - 'content': 'second test content', - 'title': 'Second Test', - 'url': 'http://second.test.xyz', - 'engines': ['youtube', 'startpage'], - 'engine': 'youtube', - 'parsed_url': ParseResult( - scheme='http', netloc='second.test.xyz', path='/', params='', query='', fragment='' - ), - 'template': 'default.html', - }, + MainResult( + title="First Test", + url="http://first.test.xyz", + content="first test content", + engine="startpage", + ), + MainResult( + title="Second Test", + url="http://second.test.xyz", + content="second test content", + engine="youtube", + ), ] - + for r in test_results: + r.normalize_result_fields() timings = [ Timing(engine='startpage', total=0.8, load=0.7), Timing(engine='youtube', total=0.9, load=0.6), -- cgit v1.2.3