Commit be384621 authored by Nicolas Gelot's avatar Nicolas Gelot
Browse files

Fix unit test selfIPTest

Broken since the change 7766167d.
parent 46e8be53
......@@ -6,8 +6,7 @@ from mock import Mock
def get_search_mock(query, **kwargs):
return Mock(search_query=Mock(query=query, **kwargs),
result_container=Mock(answers=set()))
return Mock(query=query, answers=set(), **kwargs)
class PluginStoreTest(SearxTestCase):
......@@ -50,11 +49,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.answers)
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('127.0.0.1' in search.answers)
# User agent test
request = Mock(user_agent='Mock')
......@@ -62,24 +61,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.answers)
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('Mock' in search.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.answers)
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('Mock' in search.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.answers)
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('Mock' in search.answers)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment