summaryrefslogtreecommitdiff
path: root/tests/unit/test_plugins.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/test_plugins.py')
-rw-r--r--tests/unit/test_plugins.py52
1 files changed, 26 insertions, 26 deletions
diff --git a/tests/unit/test_plugins.py b/tests/unit/test_plugins.py
index 9ba6fcdd2..c9e65dfcb 100644
--- a/tests/unit/test_plugins.py
+++ b/tests/unit/test_plugins.py
@@ -6,8 +6,8 @@ from mock import Mock
def get_search_mock(query, **kwargs):
- return {'search': Mock(query=query, **kwargs),
- 'result_container': Mock(answers=set())}
+ return Mock(search_query=Mock(query=query, **kwargs),
+ result_container=Mock(answers=set()))
class PluginStoreTest(SearxTestCase):
@@ -51,39 +51,39 @@ class SelfIPTest(SearxTestCase):
request = Mock(user_plugins=store.plugins,
remote_addr='127.0.0.1')
request.headers.getlist.return_value = []
- ctx = get_search_mock(query='ip', pageno=1)
- store.call('post_search', request, ctx)
- self.assertTrue('127.0.0.1' in ctx['result_container'].answers)
+ search = get_search_mock(query='ip', pageno=1)
+ store.call('post_search', request, search)
+ self.assertTrue('127.0.0.1' in search.result_container.answers)
- ctx = get_search_mock(query='ip', pageno=2)
- store.call('post_search', request, ctx)
- self.assertFalse('127.0.0.1' in ctx['result_container'].answers)
+ search = get_search_mock(query='ip', pageno=2)
+ store.call('post_search', request, search)
+ self.assertFalse('127.0.0.1' in search.result_container.answers)
# User agent test
request = Mock(user_plugins=store.plugins,
user_agent='Mock')
request.headers.getlist.return_value = []
- ctx = get_search_mock(query='user-agent', pageno=1)
- store.call('post_search', request, ctx)
- self.assertTrue('Mock' in ctx['result_container'].answers)
+ search = get_search_mock(query='user-agent', pageno=1)
+ store.call('post_search', request, search)
+ self.assertTrue('Mock' in search.result_container.answers)
- ctx = get_search_mock(query='user-agent', pageno=2)
- store.call('post_search', request, ctx)
- self.assertFalse('Mock' in ctx['result_container'].answers)
+ search = get_search_mock(query='user-agent', pageno=2)
+ store.call('post_search', request, search)
+ self.assertFalse('Mock' in search.result_container.answers)
- ctx = get_search_mock(query='user-agent', pageno=1)
- store.call('post_search', request, ctx)
- self.assertTrue('Mock' in ctx['result_container'].answers)
+ search = get_search_mock(query='user-agent', pageno=1)
+ store.call('post_search', request, search)
+ self.assertTrue('Mock' in search.result_container.answers)
- ctx = get_search_mock(query='user-agent', pageno=2)
- store.call('post_search', request, ctx)
- self.assertFalse('Mock' in ctx['result_container'].answers)
+ search = get_search_mock(query='user-agent', pageno=2)
+ store.call('post_search', request, search)
+ self.assertFalse('Mock' in search.result_container.answers)
- ctx = get_search_mock(query='What is my User-Agent?', pageno=1)
- store.call('post_search', request, ctx)
- self.assertTrue('Mock' in ctx['result_container'].answers)
+ search = get_search_mock(query='What is my User-Agent?', pageno=1)
+ store.call('post_search', request, search)
+ self.assertTrue('Mock' in search.result_container.answers)
- ctx = get_search_mock(query='What is my User-Agent?', pageno=2)
- store.call('post_search', request, ctx)
- self.assertFalse('Mock' in ctx['result_container'].answers)
+ search = get_search_mock(query='What is my User-Agent?', pageno=2)
+ store.call('post_search', request, search)
+ self.assertFalse('Mock' in search.result_container.answers)