summaryrefslogtreecommitdiff
path: root/searx/search/checker
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-03-25 09:37:37 +0100
committerAlexandre Flament <alex@al-f.net>2021-03-25 09:37:37 +0100
commit0b45afd4d7f23cbbc33376b861103f54c5c9f856 (patch)
tree2f794d533f6731c461ca83111563b492bc1eee91 /searx/search/checker
parent06b754ad67aa6066aed6df77b5ffb74aabebb040 (diff)
downloadsearxng-0b45afd4d7f23cbbc33376b861103f54c5c9f856.tar.gz
searxng-0b45afd4d7f23cbbc33376b861103f54c5c9f856.zip
[fix] checker: various bug fixes
* initialize engine_data (youtube engine) * don't crash if an engine don't set result['url']
Diffstat (limited to 'searx/search/checker')
-rw-r--r--searx/search/checker/impl.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/searx/search/checker/impl.py b/searx/search/checker/impl.py
index 25887b0f4..ad45440ea 100644
--- a/searx/search/checker/impl.py
+++ b/searx/search/checker/impl.py
@@ -174,7 +174,7 @@ class ResultContainerTests:
@property
def result_urls(self):
results = self.result_container.get_ordered_results()
- return [result['url'] for result in results]
+ return [result['url'] for result in results if 'url' in result]
def _record_error(self, message: str, *args) -> None:
sq = _search_query_to_dict(self.search_query)
@@ -197,6 +197,8 @@ class ResultContainerTests:
self._record_error('HTML in title', repr(result.get('title', '')))
if not _check_no_html(result.get('content', '')):
self._record_error('HTML in content', repr(result.get('content', '')))
+ if result.get('url') is None:
+ self._record_error('url is None')
self._add_language(result.get('title', ''))
self._add_language(result.get('content', ''))
@@ -310,7 +312,7 @@ class CheckerTests:
self.result_container_tests_list = result_container_tests_list
def unique_results(self):
- """Check the results of each ResultContain is unique"""
+ """Check the results of each ResultContainer is unique"""
urls_list = [rct.result_urls for rct in self.result_container_tests_list]
if len(urls_list[0]) > 0:
# results on the first page