summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2025-01-28 20:30:07 +0100
committerMarkus Heiser <markus.heiser@darmarIT.de>2025-01-29 05:04:41 +0100
commita235c54f8c8442242fe727908162e5ece8739b5a (patch)
tree5884daa5c99b86b419c3f630780eb0373a1122f0 /tests
parentdf3344e5d5fdfd2425324d5e10e8c8e5104963b0 (diff)
[mod] rudimentary implementation of a MainResult type
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/test_webapp.py39
1 files changed, 15 insertions, 24 deletions
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),