diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2020-06-11 10:15:15 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarit.de> | 2020-06-11 10:15:15 +0200 |
commit | eae34816881b97c2be8b24630244a27ec0a09c6d (patch) | |
tree | 6de5f0aeb86f81add25533b1db6b1d75c59a7e75 | |
parent | aa7c043ff40bd1c1ec2e81748627aeac24608580 (diff) | |
download | searxng-eae34816881b97c2be8b24630244a27ec0a09c6d.tar.gz searxng-eae34816881b97c2be8b24630244a27ec0a09c6d.zip |
[fix] commit 2c6531b2 breaks the unit test, this is a hotfix
commit 2c6531b2 does not only break the unit test, it is a significant change of
the data model and the searx search-syntax model (UI) without any discussion nor
documentation.
At the end, adding routes to instant answers is a nice feature but commit
2c6531b2 leaf some questions open.
In that sense, this patch is only a hotfix not a assessment.
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
-rw-r--r-- | tests/unit/test_plugins.py | 18 | ||||
-rw-r--r-- | tests/unit/test_webapp.py | 2 |
2 files changed, 10 insertions, 10 deletions
diff --git a/tests/unit/test_plugins.py b/tests/unit/test_plugins.py index e497371f8..10de8475a 100644 --- a/tests/unit/test_plugins.py +++ b/tests/unit/test_plugins.py @@ -7,7 +7,7 @@ from mock import Mock def get_search_mock(query, **kwargs): return Mock(search_query=Mock(query=query, **kwargs), - result_container=Mock(answers=set())) + result_container=Mock(answers=dict())) class PluginStoreTest(SearxTestCase): @@ -50,11 +50,11 @@ class SelfIPTest(SearxTestCase): request.headers.getlist.return_value = [] search = get_search_mock(query=b'ip', pageno=1) store.call(store.plugins, 'post_search', request, search) - self.assertTrue('127.0.0.1' in search.result_container.answers) + self.assertTrue('127.0.0.1' in search.result_container.answers["ip"]["answer"]) search = get_search_mock(query=b'ip', pageno=2) store.call(store.plugins, 'post_search', request, search) - self.assertFalse('127.0.0.1' in search.result_container.answers) + self.assertFalse('ip' in search.result_container.answers) # User agent test request = Mock(user_agent='Mock') @@ -62,24 +62,24 @@ class SelfIPTest(SearxTestCase): search = get_search_mock(query=b'user-agent', pageno=1) store.call(store.plugins, 'post_search', request, search) - self.assertTrue('Mock' in search.result_container.answers) + self.assertTrue('Mock' in search.result_container.answers["user-agent"]["answer"]) search = get_search_mock(query=b'user-agent', pageno=2) store.call(store.plugins, 'post_search', request, search) - self.assertFalse('Mock' in search.result_container.answers) + self.assertFalse('user-agent' in search.result_container.answers) search = get_search_mock(query=b'user-agent', pageno=1) store.call(store.plugins, 'post_search', request, search) - self.assertTrue('Mock' in search.result_container.answers) + self.assertTrue('Mock' in search.result_container.answers["user-agent"]["answer"]) search = get_search_mock(query=b'user-agent', pageno=2) store.call(store.plugins, 'post_search', request, search) - self.assertFalse('Mock' in search.result_container.answers) + self.assertFalse('user-agent' in search.result_container.answers) search = get_search_mock(query=b'What is my User-Agent?', pageno=1) store.call(store.plugins, 'post_search', request, search) - self.assertTrue('Mock' in search.result_container.answers) + self.assertTrue('Mock' in search.result_container.answers["user-agent"]["answer"]) search = get_search_mock(query=b'What is my User-Agent?', pageno=2) store.call(store.plugins, 'post_search', request, search) - self.assertFalse('Mock' in search.result_container.answers) + self.assertFalse('user-agent' in search.result_container.answers) diff --git a/tests/unit/test_webapp.py b/tests/unit/test_webapp.py index f31332fa0..f15e3c92c 100644 --- a/tests/unit/test_webapp.py +++ b/tests/unit/test_webapp.py @@ -48,7 +48,7 @@ class ViewsTestCase(SearxTestCase): def search_mock(search_self, *args): search_self.result_container = Mock(get_ordered_results=lambda: test_results, - answers=set(), + answers=dict(), corrections=set(), suggestions=set(), infoboxes=[], |