mirror of
https://github.com/searxng/searxng.git
synced 2024-11-23 04:27:46 +01:00
26 lines
706 B
Python
26 lines
706 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
from searx.search import score_results
|
|
from searx.testing import SearxTestCase
|
|
|
|
|
|
def fake_result(url='https://aa.bb/cc?dd=ee#ff',
|
|
title='aaa',
|
|
content='bbb',
|
|
engine='wikipedia'):
|
|
return {'url': url,
|
|
'title': title,
|
|
'content': content,
|
|
'engine': engine}
|
|
|
|
|
|
class ScoreResultsTestCase(SearxTestCase):
|
|
|
|
def test_empty(self):
|
|
self.assertEqual(score_results(dict()), [])
|
|
|
|
def test_urlparse(self):
|
|
results = score_results(dict(a=[fake_result(url='https://aa.bb/cc?dd=ee#ff')]))
|
|
parsed_url = results[0]['parsed_url']
|
|
self.assertEqual(parsed_url.query, 'dd=ee')
|