|
@@ -83,3 +83,56 @@ class SelfIPTest(SearxTestCase):
|
83
|
83
|
search = get_search_mock(query=b'What is my User-Agent?', pageno=2)
|
84
|
84
|
store.call(store.plugins, 'post_search', request, search)
|
85
|
85
|
self.assertFalse('Mock' in search.result_container.answers)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+class HashPluginTest(SearxTestCase):
|
|
89
|
+
|
|
90
|
+ def test_PluginStore_init(self):
|
|
91
|
+ store = plugins.PluginStore()
|
|
92
|
+ store.register(plugins.hash_plugin)
|
|
93
|
+
|
|
94
|
+ self.assertTrue(len(store.plugins) == 1)
|
|
95
|
+
|
|
96
|
+ request = Mock(remote_addr='127.0.0.1')
|
|
97
|
+ request.headers.getlist.return_value = []
|
|
98
|
+
|
|
99
|
+ # MD5
|
|
100
|
+ search = get_search_mock(query=b'md5 test', pageno=1)
|
|
101
|
+ store.call(store.plugins, 'post_search', request, search)
|
|
102
|
+ self.assertTrue('md5 hash function: 098f6bcd4621d373cade4e832627b4f6' in search.result_container.answers)
|
|
103
|
+
|
|
104
|
+ search = get_search_mock(query=b'md5 test', pageno=2)
|
|
105
|
+ store.call(store.plugins, 'post_search', request, search)
|
|
106
|
+ self.assertFalse('md5 hash function: 098f6bcd4621d373cade4e832627b4f6' in search.result_container.answers)
|
|
107
|
+
|
|
108
|
+ # SHA1
|
|
109
|
+ search = get_search_mock(query=b'sha1 test', pageno=1)
|
|
110
|
+ store.call(store.plugins, 'post_search', request, search)
|
|
111
|
+ self.assertTrue('sha1 hash function: a94a8fe5ccb19ba61c4c0873d391e9879'
|
|
112
|
+ '82fbbd3' in search.result_container.answers)
|
|
113
|
+
|
|
114
|
+ # SHA224
|
|
115
|
+ search = get_search_mock(query=b'sha224 test', pageno=1)
|
|
116
|
+ store.call(store.plugins, 'post_search', request, search)
|
|
117
|
+ self.assertTrue('sha224 hash function: 90a3ed9e32b2aaf4c61c410eb9254261'
|
|
118
|
+ '19e1a9dc53d4286ade99a809' in search.result_container.answers)
|
|
119
|
+
|
|
120
|
+ # SHA256
|
|
121
|
+ search = get_search_mock(query=b'sha256 test', pageno=1)
|
|
122
|
+ store.call(store.plugins, 'post_search', request, search)
|
|
123
|
+ self.assertTrue('sha256 hash function: 9f86d081884c7d659a2feaa0c55ad015a'
|
|
124
|
+ '3bf4f1b2b0b822cd15d6c15b0f00a08' in search.result_container.answers)
|
|
125
|
+
|
|
126
|
+ # SHA384
|
|
127
|
+ search = get_search_mock(query=b'sha384 test', pageno=1)
|
|
128
|
+ store.call(store.plugins, 'post_search', request, search)
|
|
129
|
+ self.assertTrue('sha384 hash function: 768412320f7b0aa5812fce428dc4706b3c'
|
|
130
|
+ 'ae50e02a64caa16a782249bfe8efc4b7ef1ccb126255d196047dfedf1'
|
|
131
|
+ '7a0a9' in search.result_container.answers)
|
|
132
|
+
|
|
133
|
+ # SHA512
|
|
134
|
+ search = get_search_mock(query=b'sha512 test', pageno=1)
|
|
135
|
+ store.call(store.plugins, 'post_search', request, search)
|
|
136
|
+ self.assertTrue('sha512 hash function: ee26b0dd4af7e749aa1a8ee3c10ae9923f6'
|
|
137
|
+ '18980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5'
|
|
138
|
+ 'fa9ad8e6f57f50028a8ff' in search.result_container.answers)
|