|
@@ -28,14 +28,12 @@ class PluginStoreTest(SearxTestCase):
|
28
|
28
|
testplugin = plugins.Plugin()
|
29
|
29
|
store.register(testplugin)
|
30
|
30
|
setattr(testplugin, 'asdf', Mock())
|
31
|
|
- request = Mock(user_plugins=[])
|
32
|
|
- store.call('asdf', request, Mock())
|
|
31
|
+ request = Mock()
|
|
32
|
+ store.call([], 'asdf', request, Mock())
|
33
|
33
|
|
34
|
34
|
self.assertFalse(testplugin.asdf.called)
|
35
|
35
|
|
36
|
|
- request.user_plugins.append(testplugin)
|
37
|
|
- store.call('asdf', request, Mock())
|
38
|
|
-
|
|
36
|
+ store.call([testplugin], 'asdf', request, Mock())
|
39
|
37
|
self.assertTrue(testplugin.asdf.called)
|
40
|
38
|
|
41
|
39
|
|
|
@@ -48,42 +46,40 @@ class SelfIPTest(SearxTestCase):
|
48
|
46
|
self.assertTrue(len(store.plugins) == 1)
|
49
|
47
|
|
50
|
48
|
# IP test
|
51
|
|
- request = Mock(user_plugins=store.plugins,
|
52
|
|
- remote_addr='127.0.0.1')
|
|
49
|
+ request = Mock(remote_addr='127.0.0.1')
|
53
|
50
|
request.headers.getlist.return_value = []
|
54
|
51
|
search = get_search_mock(query='ip', pageno=1)
|
55
|
|
- store.call('post_search', request, search)
|
|
52
|
+ store.call(store.plugins, 'post_search', request, search)
|
56
|
53
|
self.assertTrue('127.0.0.1' in search.result_container.answers)
|
57
|
54
|
|
58
|
55
|
search = get_search_mock(query='ip', pageno=2)
|
59
|
|
- store.call('post_search', request, search)
|
|
56
|
+ store.call(store.plugins, 'post_search', request, search)
|
60
|
57
|
self.assertFalse('127.0.0.1' in search.result_container.answers)
|
61
|
58
|
|
62
|
59
|
# User agent test
|
63
|
|
- request = Mock(user_plugins=store.plugins,
|
64
|
|
- user_agent='Mock')
|
|
60
|
+ request = Mock(user_agent='Mock')
|
65
|
61
|
request.headers.getlist.return_value = []
|
66
|
62
|
|
67
|
63
|
search = get_search_mock(query='user-agent', pageno=1)
|
68
|
|
- store.call('post_search', request, search)
|
|
64
|
+ store.call(store.plugins, 'post_search', request, search)
|
69
|
65
|
self.assertTrue('Mock' in search.result_container.answers)
|
70
|
66
|
|
71
|
67
|
search = get_search_mock(query='user-agent', pageno=2)
|
72
|
|
- store.call('post_search', request, search)
|
|
68
|
+ store.call(store.plugins, 'post_search', request, search)
|
73
|
69
|
self.assertFalse('Mock' in search.result_container.answers)
|
74
|
70
|
|
75
|
71
|
search = get_search_mock(query='user-agent', pageno=1)
|
76
|
|
- store.call('post_search', request, search)
|
|
72
|
+ store.call(store.plugins, 'post_search', request, search)
|
77
|
73
|
self.assertTrue('Mock' in search.result_container.answers)
|
78
|
74
|
|
79
|
75
|
search = get_search_mock(query='user-agent', pageno=2)
|
80
|
|
- store.call('post_search', request, search)
|
|
76
|
+ store.call(store.plugins, 'post_search', request, search)
|
81
|
77
|
self.assertFalse('Mock' in search.result_container.answers)
|
82
|
78
|
|
83
|
79
|
search = get_search_mock(query='What is my User-Agent?', pageno=1)
|
84
|
|
- store.call('post_search', request, search)
|
|
80
|
+ store.call(store.plugins, 'post_search', request, search)
|
85
|
81
|
self.assertTrue('Mock' in search.result_container.answers)
|
86
|
82
|
|
87
|
83
|
search = get_search_mock(query='What is my User-Agent?', pageno=2)
|
88
|
|
- store.call('post_search', request, search)
|
|
84
|
+ store.call(store.plugins, 'post_search', request, search)
|
89
|
85
|
self.assertFalse('Mock' in search.result_container.answers)
|