diff options
| author | Alexandre Flament <alex@al-f.net> | 2020-12-24 09:28:16 +0100 |
|---|---|---|
| committer | Alexandre Flament <alex@al-f.net> | 2021-01-12 11:47:17 +0100 |
| commit | 8cbc9f2d5823eb984e99e15c963e306610007fa1 (patch) | |
| tree | 4dea97c668d960926938aefc8f0f77456bee47d6 /searx/search/processors/online.py | |
| parent | f7e11fd7222363a72a8fa33cf69190f64a3880bd (diff) | |
[enh] add checker
Diffstat (limited to 'searx/search/processors/online.py')
| -rw-r--r-- | searx/search/processors/online.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/searx/search/processors/online.py b/searx/search/processors/online.py index b62f8059e..54d63b4c9 100644 --- a/searx/search/processors/online.py +++ b/searx/search/processors/online.py @@ -211,3 +211,47 @@ class OnlineProcessor(EngineProcessor): # reset the suspend variables self.engine.continuous_errors = 0 self.engine.suspend_end_time = 0 + + def get_default_tests(self): + tests = {} + + tests['simple'] = { + 'matrix': {'query': ('time', 'time')}, + 'result_container': ['not_empty'], + } + + if getattr(self.engine, 'paging', False): + # [1, 2, 3] --> isinstance(l, (list, tuple)) ?? + tests['paging'] = { + 'matrix': {'query': 'time', + 'pageno': (1, 2, 3)}, + 'result_container': ['not_empty'], + 'test': ['unique_results'] + } + + if getattr(self.engine, 'time_range', False): + tests['time_range'] = { + 'matrix': {'query': 'time', + 'time_range': (None, 'day')}, + 'result_container': ['not_empty'], + 'test': ['unique_results'] + } + + if getattr(self.engine, 'lang', False): + tests['lang_fr'] = { + 'matrix': {'query': 'paris', 'lang': 'fr'}, + 'result_container': ['not_empty', ('has_lang', 'fr')], + } + tests['lang_en'] = { + 'matrix': {'query': 'paris', 'lang': 'en'}, + 'result_container': ['not_empty', ('has_lang', 'en')], + } + + if getattr(self.engine, 'safesearch', False): + tests['safesearch'] = { + 'matrix': {'query': 'porn', + 'safesearch': (0, 2)}, + 'test': ['unique_results'] + } + + return tests |