Explorar el Código

[fix] code style

Venca24 hace 6 años
padre
commit
462650087b
Se han modificado 2 ficheros con 14 adiciones y 7 borrados
  1. 1
    0
      searx/plugins/hash_plugin.py
  2. 13
    7
      tests/unit/test_plugins.py

+ 1
- 0
searx/plugins/hash_plugin.py Ver fichero

@@ -26,6 +26,7 @@ default_on = True
26 26
 
27 27
 parser_re = re.compile(b'(md5|sha1|sha224|sha256|sha384|sha512) (.*)', re.I)
28 28
 
29
+
29 30
 def post_search(request, search):
30 31
     # process only on first page
31 32
     if search.search_query.pageno > 1:

+ 13
- 7
tests/unit/test_plugins.py Ver fichero

@@ -84,6 +84,7 @@ class SelfIPTest(SearxTestCase):
84 84
         store.call(store.plugins, 'post_search', request, search)
85 85
         self.assertFalse('Mock' in search.result_container.answers)
86 86
 
87
+
87 88
 class HashPluginTest(SearxTestCase):
88 89
 
89 90
     def test_PluginStore_init(self):
@@ -107,26 +108,31 @@ class HashPluginTest(SearxTestCase):
107 108
         # SHA1
108 109
         search = get_search_mock(query=b'sha1 test', pageno=1)
109 110
         store.call(store.plugins, 'post_search', request, search)
110
-        self.assertTrue('sha1 hash function: a94a8fe5ccb19ba61c4c0873d391e987982fbbd3' in search.result_container.answers)
111
+        self.assertTrue('sha1 hash function: a94a8fe5ccb19ba61c4c0873d391e9879'
112
+                        '82fbbd3' in search.result_container.answers)
111 113
 
112 114
         # SHA224
113 115
         search = get_search_mock(query=b'sha224 test', pageno=1)
114 116
         store.call(store.plugins, 'post_search', request, search)
115
-        self.assertTrue('sha224 hash function: 90a3ed9e32b2aaf4c61c410eb925426119e1a9dc53d4286ade99a809' in search.result_container.answers)
117
+        self.assertTrue('sha224 hash function: 90a3ed9e32b2aaf4c61c410eb9254261'
118
+                        '19e1a9dc53d4286ade99a809' in search.result_container.answers)
116 119
 
117 120
         # SHA256
118 121
         search = get_search_mock(query=b'sha256 test', pageno=1)
119 122
         store.call(store.plugins, 'post_search', request, search)
120
-        self.assertTrue('sha256 hash function: 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08' in search.result_container.answers)
123
+        self.assertTrue('sha256 hash function: 9f86d081884c7d659a2feaa0c55ad015a'
124
+                        '3bf4f1b2b0b822cd15d6c15b0f00a08' in search.result_container.answers)
121 125
 
122 126
         # SHA384
123 127
         search = get_search_mock(query=b'sha384 test', pageno=1)
124 128
         store.call(store.plugins, 'post_search', request, search)
125
-        self.assertTrue('sha384 hash function: 768412320f7b0aa5812fce428dc4706b3cae50e02a64caa16a782249bfe8efc4b' \
126
-          '7ef1ccb126255d196047dfedf17a0a9' in search.result_container.answers)
129
+        self.assertTrue('sha384 hash function: 768412320f7b0aa5812fce428dc4706b3c'
130
+                        'ae50e02a64caa16a782249bfe8efc4b7ef1ccb126255d196047dfedf1'
131
+                        '7a0a9' in search.result_container.answers)
127 132
 
128 133
         # SHA512
129 134
         search = get_search_mock(query=b'sha512 test', pageno=1)
130 135
         store.call(store.plugins, 'post_search', request, search)
131
-        self.assertTrue('sha512 hash function: ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27a' \
132
-'c185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff' in search.result_container.answers)
136
+        self.assertTrue('sha512 hash function: ee26b0dd4af7e749aa1a8ee3c10ae9923f6'
137
+                        '18980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5'
138
+                        'fa9ad8e6f57f50028a8ff' in search.result_container.answers)